Click here to Skip to main content
15,896,557 members
Articles / Desktop Programming / XAML

Silverlight Experimental Hacks (SLEX) - EventTrigger, PropertyTrigger, ReactiveTrigger, InvokeMethodAction, StoryBoardAction, etc. for Silverlight

Rate me:
Please Sign up or sign in to vote.
4.81/5 (8 votes)
14 Jan 2010CPOL6 min read 41K   241   24  
A set of Silverlight Experimental Hacks (1) A custom implementation of EventTrigger and PropertyTrigger (2) Invoking methods in your view model in MVVM (3) Conditionally invoking triggers and behaviors (4) ReactiveTrigger for exporting your custom events
<navigation:Page x:Class="Slex.Lib.Demo.Home" 
    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:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
    Title="Home">

    <Grid x:Name="LayoutRoot">
        <ScrollViewer HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch">

            <StackPanel x:Name="ContentStackPanel" >

                <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" 
                                   Text="Slex Demos Included"/>
                <TextBlock x:Name="ContentText" Style="{StaticResource ContentTextStyle}" 
                                   Text="Please select an item below to view the related demo"/>
                <Rectangle Height="1" Fill="LightGray" Margin="2"/>
                <StackPanel x:Name="LinksStackPanel"  HorizontalAlignment="Left" Margin="2">
                    <TextBlock FontWeight="Bold" FontSize="14" Text="Basic Demos" Foreground="LightBlue" Margin="3"></TextBlock>
                    <HyperlinkButton x:Name="Link1" Margin="3" 
                                     NavigateUri="/Demos/EventTrigger" Content="[>] Simple EventTrigger Demo"/>
                    <TextBlock TextWrapping="Wrap" Text="Shows how to fire a a command when an event is raised, based on conditions" Margin="3" />
                    <HyperlinkButton x:Name="Link2" Margin="3" 
                                     NavigateUri="/Demos/PropertyTrigger" Content="[>] Simple PropertyTrigger Demo"/>
                    <TextBlock TextWrapping="Wrap" Text="Shows how to fire a command when a property is changed, based on conditions" Margin="3" />
                    <HyperlinkButton x:Name="Link3" Margin="3" 
                                     NavigateUri="/Demos/InvokeMethod" Content="[>] Simple Invoke Method Demo"/>
                    <TextBlock TextWrapping="Wrap" Text="Shows how to invoke a method, and pass the parameters, based on conditions" Margin="3" />
                    <HyperlinkButton x:Name="Link4" Margin="3" 
                                     NavigateUri="/Demos/InvokeCommand" Content="[>] Simple Invoke Command Demo"/>
                    <TextBlock TextWrapping="Wrap" Text="Shows how to invoke a command, and pass the parameters, based on conditions" Margin="3" />
                    <HyperlinkButton x:Name="Link5" Margin="3" 
                                     NavigateUri="/Demos/StoryBoardAction" Content="[>] Story Board Action Demo"/>
                    <TextBlock TextWrapping="Wrap" Text="Shows how to use Slex StoryBoardAction" Margin="3" />
                    <HyperlinkButton x:Name="Link6" Margin="3" 
                                     NavigateUri="/Demos/ReactiveTrigger" Content="[>] Reactive Trigger Example"/>
                    <TextBlock TextWrapping="Wrap" Text="Shows how to use a reactive trigger" Margin="3" />
                    <HyperlinkButton x:Name="Link7" Margin="3" 
                                     NavigateUri="/Demos/SetPropertyAction" Content="[>] PropertyAction Example (Set)"/>
                    <TextBlock TextWrapping="Wrap" Text="Shows how to set a property" Margin="3" />
                    <HyperlinkButton x:Name="Link8" Margin="3" 
                                     NavigateUri="/Demos/ConditionalTriggers" Content="[>] ConditionalTriggers Example (Set)"/>
                    <TextBlock TextWrapping="Wrap" Text="Shows how to ensure a trigger is fired only if conditions are met" Margin="3" />
                </StackPanel>

            </StackPanel>

        </ScrollViewer>
    </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.

License

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


Written By
Architect
India India
Architect, Developer, Speaker | Wannabe GUT inventor & Data Scientist | Microsoft MVP in C#

Comments and Discussions