|
<navigation:Page x:Class="Slex.Lib.Demo.Views.Demos.EventTrigger"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:slex="clr-namespace:Slex.Lib.Interactions;assembly=Slex.Lib"
mc:Ignorable="d"
xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
d:DesignWidth="640" d:DesignHeight="480"
Title="EventTrigger Page">
<Grid x:Name="LayoutRoot">
<i:Interaction.Triggers>
<slex:EventTrigger ElementName="txtData" EventName="KeyUp">
<slex:InvokeCommandAction CommandName="UpdateDataCommand">
<slex:InvokeCommandAction.Conditions>
<slex:InvokingConditions>
<slex:InvokingCondition Property="Argument.Key" Value="A"/>
<slex:InvokingCondition ElementName="myCheckBox" Property="IsChecked" Value="True"/>
</slex:InvokingConditions>
</slex:InvokeCommandAction.Conditions>
</slex:InvokeCommandAction>
</slex:EventTrigger>
</i:Interaction.Triggers>
<StackPanel>
<TextBlock FontSize="20" Text="Event Trigger Demo"/>
<TextBlock Margin="4" TextWrapping="Wrap"
Text="This demo shows how to invoke an action when an event is raised, based on multiple conditions. Type 'A' in the below text box, with the check box checked, to fire the Command in the view model"/>
<TextBox Margin="4" Name="txtData" Text="Type A here, with the checkbox checked"/>
<StackPanel Background="LightGray" Margin="5">
<TextBlock Margin="4" Text="{Binding Data}" FontSize="14"/>
<CheckBox Name="myCheckBox" Content="Check to Fire The Command if A is pressed"/>
</StackPanel>
</StackPanel>
</Grid>
</navigation:Page>
|
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.
Architect, Developer, Speaker | Wannabe GUT inventor & Data Scientist | Microsoft MVP in C#