I created a new tab for the backstage. In this tab I have a listbox and a button.
The button is a ribbon:Button and through its StaysOpenOnClick property I am able to determine whether the backstage should close or not.
The listbox is a WPF listbox. I have a command configured on the PreviewMouseLeftButtonUp.
I want to be able to close the the Backstage when the event is handled. The event handler receives the backstage as argument but it does not seem to be useful.
Code snippet below:
<ListBox SelectionMode="Single" ItemsSource="{Binding MyList,Mode=OneWay}" SelectedItem="{Binding SelectedItem, Mode=OneWayToSource}"
ItemContainerStyle="{StaticResource MyLookStyle}"> <-- This is my style
<MyCmd:EventBehaviorCollection.Behaviors>
<MyCmd:EventCommandBinding EventName="PreviewMouseLeftButtonUp" Command="{Binding OpenMyCommand}" CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ribbon:Backstage}}}"/>
</shellCmd:EventBehaviorCollection.Behaviors>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Width="25" Height="25" Margin="5" HorizontalAlignment="Center" Style="{StaticResource iconImageStyle}"/>
<TextBlock Text ="{Binding Name}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> </StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Any way you can help me with this?