Click here to Skip to main content
11,638,764 members (75,350 online)
Click here to Skip to main content
Add your own
alternative version

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

, 14 Jan 2010 CPOL 18.3K 236 24
A set of extensibility hacks for WPF. A few interesting triggers and actions, including EventTrigger, ReactiveTrigger, InvokeMethodAction, and InvokeCommandAction. Also allows invoking Triggers and Actions based on Conditions.
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
ClassDiagram1.cd
Wex.csproj.user
bin
Debug
WexEventTrigger.dll
WexEventTrigger.vshost.exe
WexEventTrigger.vshost.exe.manifest
Composition
Lib
Properties
Settings.settings
Reactive
WexEventTrigger.Demo
bin
Debug
WexEventTrigger.Demo.vshost.exe
WexEventTrigger.Demo.vshost.exe.manifest
Commands
Extensions
Properties
Settings.settings
Views
Demos
<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 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.

License

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

Share

About the Author


You may also be interested in...

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