Click here to Skip to main content
Click here to Skip to main content

WPF Extensibility Hacks or WEX - Includes EventTrigger, ReactiveTrigger, InvokeMethodAction, InvokeCommandAction etc.

By , 14 Jan 2010
 
Wex.zip
Assemblies
Microsoft.Expression.Interactions.dll
System.ComponentModel.Composition.dll
System.CoreEx.dll
System.Interactive.dll
System.Reactive.dll
System.Windows.Interactivity.dll
WexEventTrigger.Demo
bin
Debug
WexEventTrigger.Demo.vshost.exe
WexEventTrigger.Demo.vshost.exe.manifest
Commands
Extensions
Properties
Settings.settings
Views
Demos
WexEventTrigger
bin
Debug
WexEventTrigger.dll
WexEventTrigger.vshost.exe
WexEventTrigger.vshost.exe.manifest
ClassDiagram1.cd
Composition
Lib
Properties
Settings.settings
Reactive
Wex.csproj.user
<UserControl x:Class="Wex.Lib.Demo.Views.Demos.PropertyTrigger" 
           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:wex="clr-namespace:Wex.Lib.Interactions;assembly=Wex.Lib"      
           mc:Ignorable="d"
           d:DesignWidth="640" d:DesignHeight="480">
    <Grid x:Name="LayoutRoot">
        <i:Interaction.Triggers>
            <!--
            <wex:PropertyTrigger ElementName="txtData" Property="Text">
                <wex:InvokeCommandAction CommandName="UpdateDataCommand">
                    <wex:InvokeCommandAction.Conditions>
                    <wex:InvokingConditions>
                        <wex:InvokingCondition Value="Hello"/>
                        <wex:InvokingCondition ElementName="myCheckBox" Property="IsChecked" Value="True"/>
                    </wex:InvokingConditions>
                  </wex:InvokeCommandAction.Conditions>
                </wex:InvokeCommandAction>
            </wex:PropertyTrigger>
            -->
        </i:Interaction.Triggers>
        <StackPanel>
            <TextBlock FontSize="20" Text="Property Trigger Demo"/>
            <TextBlock Margin="4" TextWrapping="Wrap" 
                       Text="This demo shows how to invoke an action when a property is changed, based on multiple conditions. Type 'Hello' in the below text box, with the check box checked, to fire the command"/>
            <TextBox Margin="4" Name="txtData" Text="Type Hello 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 'Hello' is entered"/>
            </StackPanel>
        </StackPanel>
    </Grid>
</UserControl>

By viewing downloads associated with this article you agree to the Terms of use 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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Anoop Madhusudanan
Architect
India India
Member

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 14 Jan 2010
Article Copyright 2010 by Anoop Madhusudanan
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid