eventtrigger

Fading out a wpf window on close

醉酒当歌 提交于 2019-11-27 12:13:24
问题 I want to fade a window in/out in my application. Fading in occurs on Window.Loaded and I wanted to fade out on close ( Window.Closed or Window.Closing ). Fading in works perfectly, but Window.Closing is not allowed value for RoutedEvent property. What RoutedEvent should I be using for Close? <Window.Triggers> <EventTrigger RoutedEvent="Window.Loaded"> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:2" FillBehavior="HoldEnd" />

WPF - Set Focus when a button is clicked - No Code Behind

南楼画角 提交于 2019-11-27 03:45:54
Is there a way to set Focus from one control to another using WPF Trigger s? Like the following example: <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <TextBox Name="txtName"></TextBox> <TextBox Grid.Row="1" Name="txtAddress"></TextBox> <Button Grid.Row="2" Content="Finish"> <Button.Triggers> <EventTrigger RoutedEvent="Button.Click"> <!-- Insert cool code here--> </EventTrigger> </Button.Triggers> </Button> <

How to open a WPF Popup when another control is clicked, using XAML markup only?

99封情书 提交于 2019-11-27 02:52:22
I've got two controls, a TextBlock and a PopUp. When the user clicks (MouseDown) on the textblock, I want to display the popup. I would think that I could do this with an EventTrigger on the Popup, but I can't use setters in an EventTrigger, I can only start storyboards. I want to do this strictly in XAML, because the two controls are in a template and I don't know how I'd find the popup in code. This is what conceptually I want to do, but can't because you can't put a setter in an EventTrigger (like you can with a DataTrigger): <TextBlock x:Name="CCD">Some text</TextBlock> <Popup> <Popup

How can I Have a WPF EventTrigger on a View trigger when the underlying Viewmodel dictates it should?

耗尽温柔 提交于 2019-11-27 01:01:07
Here's the scenario: I have the following user control, the idea is that it's view model should be able to signal to the view that it needs to "Activate the Glow", thereby playing the Storyboard. <UserControl x:Class="View.UnitView" ... > ... <Storyboard x:Key="ActivateGlow"> ... </Storyboard> ... <!-- INVALID BINDING! Not Dependancy Object--> <EventTrigger RoutedEvent="{Binding OnActivateGlow}"> <BeginStoryboard Storyboard="{StaticResource ActivateGlow}"/> </EventTrigger> </UserControl> in the codebehind for UnitView, I have: public event EventHandler ActivateGlow; and as is pretty normal in

Creating Storyboard in code behind in WPF

 ̄綄美尐妖づ 提交于 2019-11-26 22:53:38
问题 The following code is working fine. <Window.Triggers> <EventTrigger RoutedEvent="Window.Loaded"> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:.8" Storyboard.TargetProperty="Left" From="1920" To="0" AccelerationRatio=".1"/> </Storyboard> </BeginStoryboard> </EventTrigger> </Window.Triggers> But in this From and To values are static . I need to pass the values dynamically based system resolution. So i need it to be created in code behind. Is it possible to do ? How to convert

How to open a WPF Popup when another control is clicked, using XAML markup only?

扶醉桌前 提交于 2019-11-26 22:14:25
问题 I've got two controls, a TextBlock and a PopUp. When the user clicks (MouseDown) on the textblock, I want to display the popup. I would think that I could do this with an EventTrigger on the Popup, but I can't use setters in an EventTrigger, I can only start storyboards. I want to do this strictly in XAML, because the two controls are in a template and I don't know how I'd find the popup in code. This is what conceptually I want to do, but can't because you can't put a setter in an

Setting a property with an EventTrigger

倖福魔咒の 提交于 2019-11-26 18:38:16
I want to be able to set a property with an EventTrigger, there's a number of problems with this. 1) EventTriggers only support Actions, so I must use a storyBoard to set my properties. 2) Once I use a storyboard, I have two options: Stop: Once the animation has stopped the value reverts back to before the animation started HoldEnd: This locks the property, so that neither code, nor user interaction can change the property that the animation is holding. In the below example, I want to set the IsChecked property to False when the button is clicked and I want the user to be able to change the

How to get JQuery.trigger(&#39;click&#39;); to initiate a mouse click

本小妞迷上赌 提交于 2019-11-26 15:44:12
I'm having a hard time understand how to simulate a mouse click using JQuery. Can someone please inform me as to what i'm doing wrong. HTML: <a id="bar" href="http://stackoverflow.com" target="_blank">Don't click me!</a> <span id="foo">Click me!</span> jQuery: jQuery('#foo').on('click', function(){ jQuery('#bar').trigger('click'); }); Demo: FIDDLE when I click on button #foo I want to simulate a click on #bar however when I attempt this, nothing happens. I also tried jQuery(document).ready(function(){...}) but without success. Alex W You need to use jQuery('#bar')[0].click(); to simulate a

WPF - Set Focus when a button is clicked - No Code Behind

穿精又带淫゛_ 提交于 2019-11-26 10:46:24
问题 Is there a way to set Focus from one control to another using WPF Trigger s? Like the following example: <Page xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"> <Grid> <Grid.RowDefinitions> <RowDefinition/> <RowDefinition/> <RowDefinition/> </Grid.RowDefinitions> <TextBox Name=\"txtName\"></TextBox> <TextBox Grid.Row=\"1\" Name=\"txtAddress\"></TextBox> <Button Grid.Row=\"2\" Content=\"Finish\"> <Button.Triggers>

How to get JQuery.trigger(&#39;click&#39;); to initiate a mouse click

那年仲夏 提交于 2019-11-26 04:36:00
问题 I\'m having a hard time understand how to simulate a mouse click using JQuery. Can someone please inform me as to what i\'m doing wrong. HTML: <a id=\"bar\" href=\"http://stackoverflow.com\" target=\"_blank\">Don\'t click me!</a> <span id=\"foo\">Click me!</span> jQuery: jQuery(\'#foo\').on(\'click\', function(){ jQuery(\'#bar\').trigger(\'click\'); }); Demo: FIDDLE when I click on button #foo I want to simulate a click on #bar however when I attempt this, nothing happens. I also tried jQuery