locked
Navigating back to view invokes selectionchanged event on listbox RRS feed

  • Question

  • Hi

    I have an OrdersHomeView that displays a another view in a panel, this view has a listbox displaying records of previously viewed orders.  All loads fine.

    When I click on an item in the listbox this will invoke a command that will open another view displaying the details of the selected record in the listbox.  This also works fine.  The xaml for the listbox is as follows:

    <telerik:RadListBox ItemsSource="{Binding LastViewedOrders}"
    				ItemTemplate="{StaticResource ListBoxOpen_ViewedOrdersTemplate}"
                    SelectedItem="{Binding CurrentOrder, Mode=TwoWay}"
    				x:Name="lstViewedOrders">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="SelectionChanged">
                            <ic:CallMethodAction MethodName="ViewOrder"  TargetObject="{Binding}"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
    </telerik:RadListBox>
    My problem is that if I navigate (using Prism navigation, but don't think thats the problem) back to the OrdersHomeView 
    the ViewOrder command gets called again.
    This causes a loop in my app.
    Can anyone tell me what I'm doing wrong here.
    Thanks
    Paul
    Tuesday, March 20, 2012 6:44 PM

Answers

  • Paul3654

    The SelectionChanged fire every time when undering source get changed.

    EG. CollectionItem.CurrentItem = null; this stop to fire the event.

    Tuesday, March 20, 2012 6:55 PM