none
handling Accordion SelectionChanged in ViewModel of Silverlight 4

    Question

  • I would like to handle  Accordion SelectionChanged event in Viewmodel..we are using PRISM framework and silverlight 4.0

    thanks in advance

    Thursday, October 13, 2011 1:37 PM

Answers

  • Hi,

    For Event trigger, You have to install Expression Blend App.

    Then.

    1. Add a reference to System.Windows.Interactivity.

    2. Map name space to XAML. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"

    3. How to use.

    e.g:

    <TextBox x:Name="tb" Grid.Column="1" Text="{Binding Path=ActiveGame.Title, Mode=TwoWay, ValidatesOnExceptions=True}" >
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="TextChanged">
                        <i:InvokeCommandAction Command="{Binding ElementName=ChildGrid,Path=DataContext.TextChangedCommand}"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </TextBox>

    //

    <layoutToolkit:Accordion x:Name="acc" Grid.Column="0">
    <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <i:InvokeCommandAction Command="{Binding Path=Command}"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
          </layoutToolkit:Accordion>

    //ViewModel

     

    public ICommand Command{get; set;}

    Thursday, October 13, 2011 3:03 PM