<UserControl x:Class="Wex.Lib.Demo.Views.Demos.ConditionalTriggers" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:wex="clr-namespace:Wex.Lib.Interactions;assembly=Wex.Lib" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480" > <Canvas Background="WhiteSmoke"> <i:Interaction.Triggers> <wex:EventTrigger ElementName="btnBegin" EventName="Click" > <wex:StoryBoardAction StoryBoardKey="strBoard" Action="Begin"/> <wex:EventTrigger.Conditions> <wex:InvokingConditions> <wex:InvokingCondition ElementName="chkMain" Property="IsChecked" Value="True"/> </wex:InvokingConditions> </wex:EventTrigger.Conditions> </wex:EventTrigger> </i:Interaction.Triggers> <Canvas.Resources> <Storyboard x:Key="strBoard"> <!-- Animate the center point of the ellipse. --> <DoubleAnimation Storyboard.TargetProperty="Width" Storyboard.TargetName="myRect" Duration="0:0:5" From="30" To="300" RepeatBehavior="Forever" /> </Storyboard> </Canvas.Resources> <StackPanel Orientation="Horizontal" Canvas.Left="10" Canvas.Top="265"> <Rectangle Fill="Red" Name="myRect" Width="20" Height="40"/> <!-- Button that begins animation. --> <!-- Button that begins animation. --> <Button x:Name="btnBegin" Width="65" Height="30" Margin="2" Content="Begin" /> <CheckBox x:Name="chkMain" Content="Storyboard will start only if this is checked"/> <!-- Button that begins animation. --> </StackPanel> </Canvas> </UserControl>
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)