|
Hi,
I would like to implement a pop-up on screen keyboard which can be used to interact with a textbox through a touchscreen. I've found a load of WPF examples online but they all cause Security Exceptions when used in Partial Trust (as they use keyboard events).
Can anyone point me at a resource which will provide this functionality in a partial-trust XBAP?
Regards
Richard
|
|
|
|
|
I use animations all the time in WPF, but they seem to work completely different in Silverlight, principally because the elements being animated don't have a BeginAnimation method. So, given the element being animated, how can I find the Storyboard defining the animation?
|
|
|
|
|
fjparisIII wrote: Storyboard defining the animation
Not quite sure I understand your question.
What you need to do is create a Storyboard - see here[^].Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
I thought it was clear that I had created my Storyboard in XAML. This is what I had before I made my first post:
<navigation:Page.Resources>
<Storyboard x:Name="image01fadeIn">
<DoubleAnimation
Storyboard.TargetName="image01"
Storyboard.TargetProperty="Opacity"
From="0" To="1"
Duration="0:0:0.5"
Completed="imag01FadeInAnimation_Completed"
>
</DoubleAnimation>
</Storyboard>
</navigation:Page.Resources>
Now I'm getting an event where I have a reference to the element I want to start the above animation on. Given the reference to that the element (image01), how do I find the above Storyboard so I can start the animation? It was simple in WPF, because I could create the animation in code and use BeginAnimation() right there in the code. But in Silverlight, apparently you have to create the Storyboard in a XAML resource.
Maybe my question should be: how would I replace the above XAML with in-line C# code?
|
|
|
|
|
Your code in C# will look something very similar to -
Storyboard sb = new Storyboard();<br />
DoubleAnimation objAnimation = new DoubleAnimation();<br />
objAnimation.From = 0;<br />
objAnimation.To = 1;<br />
objAnimation.Duration = new Duration(new TimeSpan(500));<br />
objAnimation.Completed +=new EventHandler(imag01FadeInAnimation_Completed);<br />
Storyboard.SetTargetProperty(objAnimation, new PropertyPath("(Opacity)"));<br />
Storyboard.SetTarget(objAnimation, image1);<br />
sb.Children.Add(objAnimation);<br />
sb.Begin();<br /> Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Exactly. Just after I posted my reply, I woke up and banged the side of my head with the palm of my hand. I work too many hours in the day and my brain stops working after about 12 hours of headscratching at my desk. My original post was written after 16 hours at the keyboard. Then when I woke up this morning I was still thinking I didn't have a clue. But my brain started waking up at the very end to my reply to your first answer. Then I sat down and wrote the following code (amazingly similar to yours):
ImageBeingDisplayed.Source = BitmapImage;
DoubleAnimation fadeInAnimation = new DoubleAnimation();
fadeInAnimation.From = 0;
fadeInAnimation.To = 1;
fadeInAnimation.Duration = TimeSpan.FromSeconds(.5);
fadeInAnimation.Completed += new EventHandler(fadeInAnimation_Completed);
Storyboard storyboard = new Storyboard();
Storyboard.SetTarget(fadeInAnimation, ImageBeingDisplayed);
Storyboard.SetTargetProperty(fadeInAnimation, new PropertyPath("Image.Opacity"));
storyboard.Children.Add(fadeInAnimation);
storyboard.Begin();
Then I wrote the fadeInAnimation_Completed event as follows:
void fadeInAnimation_Completed(object sender, EventArgs e)
{
Storyboard storyboard = (Storyboard)sender;
storyboard.Stop();
string imageName = Storyboard.GetTargetName(storyboard);
Image image = FindName(imageName) as Image;
if (image != null)
{
image.Opacity = 1;
}
}
I don't know whether all this will work because the first block of code is in a WebClient.DownloadDataCompleted event handler, which inexplicably does not exist in Silverlight (I'm trying to port my WPF application to Silverlight), so my Silverlight code does not compile. I asked how to solve that problem in a post immediately preceding the post that started this thread.
|
|
|
|
|
Hi All,
I have developed a simple WPF application, where I want to send key (i.e. F5) so that all controls gets filled with updated data from DB. I have already written code for this and it works fine when i press F5.
What i want to do now is that I want some way to send F5 key through code so that after doing some action it does F5 through code. [I cannot directly call the method which performs repaint task because I am in another class]
Any help?
Thanks,
AksharRoop
|
|
|
|
|
|
Does this works for WPF window as well?
Because when i tried using this it gives error that your application is not set to handle window messages?
I cannot change structure of application because drag-drop framework is designed such that there are different classes, so when item is moved from Window, it is handled by framework class and once processed I want framework to send key.
|
|
|
|
|
Well... I didn't verify that it would or would not work. I thought "why would it not?" The message about the application not handling window messages is ridiculous. Every window in Windows must send and receive Windows messages on some level. That is the way Windows works. I also tried using SendWait like the error suggests but that doesn't work.
The only thing I can think of is to have some class with a static/shared event and method that raises that event. Then your window that needs the refresh could register to that event and the class that needs to send the refresh could call the method that sends the event. I hope that is not too confusing. It doesn't seem like a great solution but it will work.
|
|
|
|
|
Hi All,
I'm working on my first Silverlight application and I have a need to scan directories local to the web site. However, due to SIlverlight running on the client I'm figuring that the only way to do this is via a Silverlight enabled WCF service running back on the server.
This way the client silverlight app can 'phone home'?
Is that a fair assumption? Or is there a better way? This is all silverlight 3.
Cheers,
|
|
|
|
|
That's pretty much true except you could pass in parameters to the silverlight app before it starts running, as an alternative.
|
|
|
|
|
Ahhh, a kind of web version of:
static void Main(string[] args)
|
|
|
|
|
|
I have a menu page which contains a list of HyperLinkButton objects.
At various times I will select an itme from the menu and when I click another link it does nothing.
My xaml is defined as follows ... and all pages referenced exist. If I finally hit a link that works and go back to the link not working, the page will load.
Any ideas as to why this happens?
<StackPanel HorizontalAlignment="Left" Width="800">
<Image Margin="115,0,0,0" Source="LogoPrototype.png" Stretch="Fill" HorizontalAlignment="Left" Width="530" Height="71"/>
<Border Height="25" BorderThickness="0,1">
<Border.BorderBrush>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="#FFCDD9F0" Offset="0"/>
<GradientStop Color="#FF2C68CE" Offset="1"/>
</LinearGradientBrush>
</Border.BorderBrush>
<StackPanel Orientation="Horizontal">
<HyperlinkButton x:Name="customerlink" Tag="/Views/CustomerAdmin.xaml" Click="NavigateRequestHandler" BorderThickness="0" VerticalAlignment="Top" Content="Customers" Margin="12,4,3,0" NavigateUri="/Views/CustomerAdmin.xaml" TargetName="mainFrame" Foreground="#FF547C9F" />
<HyperlinkButton x:Name="contactLink" Tag="/Views/ManageCustomerLocations.xaml" Click="NavigateRequestHandler" Content="Contacts" BorderThickness="2,3,2,0" VerticalAlignment="Top" Margin="12,4,3,0" NavigateUri="/Views/ContactManager.xaml" TargetName="mainFrame" Foreground="#FF547C9F" Cursor="Hand"/>
<HyperlinkButton x:Name="locationlink" Tag="/Views/CarrierSetup.xaml" Click="NavigateRequestHandler" Content="Locations" BorderThickness="2,4,2,0" VerticalAlignment="Top" Margin="12,4,3,0" TargetName="mainFrame" Foreground="#FF547C9F" NavigateUri="/Views/ManageCustomerLocations.xaml"/>
<HyperlinkButton x:Name="carrierlink" Tag="/Views/CarrierSetup.xaml" Click="NavigateRequestHandler" Content="Carriers" BorderThickness="2,3,2,0" VerticalAlignment="Top" Margin="12,4,3,0" NavigateUri="/Views/CarrierSetup.xaml" TargetName="mainFrame" Foreground="#FF547C9F"/>
<HyperlinkButton x:Name="xconnectlink" Tag="/Views/CarrierSetup.xaml" Click="NavigateRequestHandler" Content="XConnects" BorderThickness="2,3,2,0" VerticalAlignment="Top" Margin="12,4,3,0" NavigateUri="/Views/ManageCrossConnects.xaml" TargetName="mainFrame" Foreground="#FF547C9F"/>
<HyperlinkButton x:Name="xconnectlink_Copy" Tag="/Views/CarrierSetup.xaml" Click="NavigateRequestHandler" Content="Exacent" BorderThickness="2,3,2,0" VerticalAlignment="Top" Margin="12,4,3,0" NavigateUri="/Views/ManageCrossConnects.xaml" TargetName="mainFrame" Foreground="#FF547C9F"/>
<HyperlinkButton x:Name="buildinglink" Tag="/Views/NewBuidingSetup.xaml" Click="NavigateRequestHandler" Content="Buildings" BorderThickness="2,3,2,0" VerticalAlignment="Top" Margin="12,4,3,0" NavigateUri="/Views/NewBuildingSetup.xaml" TargetName="mainFrame" Foreground="#FF547C9F"/>
</StackPanel>
</Border>
</StackPanel>
This is the logic that NavigateRequestHandler implements:
private void NavigateRequestHandler( object sender, RoutedEventArgs args )
{
HyperlinkButton requestor = sender as HyperlinkButton;
if ( requestor == null ) return;
string uri = requestor.Tag.ToString( );
this.mainFrame.Navigate( new Uri( uri, UriKind.Relative ) );
}
|
|
|
|
|
Michael Eber wrote: hit a link that works
Is this link that works the same one all the time?
Then maybe your URIs are not somehow pointing to the right files.Me, I'm dishonest. And a dishonest man you can always trust to be dishonest. Honestly. It's the honest ones you want to watch out for...
|
|
|
|
|
|
Hi
I want to place an image on the background of a form. But how? What is the image property and what takes it as argument.
send me syntax
ThanksSyed Shahid Hussain
|
|
|
|
|
First you ask what value WPF has, now you're asking how to use it. I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Because I'm new to WPF and I'm going to learn it. I like its interface and graphics capabilities but i dont know its power that how big applications can be developed under this technology
Explain it if u have time in only two or three sentences. Even write this that it is best for large data driven applications and with high graphics capabilities. It would be enough for me.
ThanksSyed Shahid Hussain
|
|
|
|
|
If you take a look at my article (page 18) in this e-book[^], you should get a little bit of an idea why WPF is so powerful."WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
hi all
What is the Performance, worth and scope of WPC. Is it known a better thing from microsoft or not? Can anyone answer the worth of WPF?
ThanksSyed Shahid Hussain
|
|
|
|
|
|
|
Hi,
I have a wpf application and for DispatcherUnhandledException exception, I want to write an entry in system log.
if (!EventLog.SourceExists("ApplicationName"))
EventLog.CreateEventSource("ApplicationName", "Error Log");
EventLog.WriteEntry("ApplicationName", e.Exception.Message + "\n" + "Stack Trace:" + "\n" + e.Exception.StackTrace,EventLogEntryType.Error);
Above code is working fine on development machine on deployment, since I have administrative rights.
But on the client machine, user not having administrative rights can not run application on clickOnce deployment.
This is because EventLog.CreateEventSource method requires administrative rights.
ClickOnce deployment is per user deployment and very handy.
So, I was wondering if there is any technique to write event logs.
I am writing errorlog to a text file for now.
Thanks,
Vsaratkar
|
|
|
|
|
Can anybody point me in the right direction how to do this please.
I have found a few samples showing how to do it in WinForms but they all say it doesn't work in WPF.
The files I will be dragging into the WPF app will all be text files so it doesn't need anything fancy.
|
|
|
|