I created a listbox menu to browse through content by clicking items in the listbox. I also created ‘back’ and ‘forward’ type of navigation to browse through the same content based on the browsing history. I load content into frame and accessing the browsing history with NavigationCommands.BrowseBack and BrowseForward Properties. It is working great. However, I need to indicate a selected state of the listbox item related to the content shown in the frame while browsing with Back/Forward buttons. I have a hard time binding that property. What is the correct way to bind selected state of the listitem in this case? Thank you in advance.
XAML: Button
<Button x:Name="NavBack" Content="" HorizontalAlignment="Left" Margin="20,0,0,0"
Style="{DynamicResource BackButtonStyle}" VerticalAlignment="Top"
CommandTarget="{Binding ElementName=ContentFrame}"
Command="{x:Static NavigationCommands.BrowseBack}"
SnapsToDevicePixels="True"
IsEnabled="{Binding CanGoBack, ElementName=ContentFrame, Mode=OneWay}"
>
XAML: Listbox
<ListBox x:Name="Nav_ListBox" Margin="0,18,0,0" ScrollViewer.HorizontalScrollBarVisibility="Hidden"
Background="#FFF2F2F2"
ItemsSource="{Binding Source={StaticResource PagesData}, XPath=page}"
Padding="0" IsTabStop="True"
BorderBrush="Black"
FontFamily="Segoe UI Light"
Foreground="Black"
BorderThickness="0"
Width="215"
SelectedIndex="0"
Grid.Column="0" HorizontalAlignment="Left"
ItemContainerStyle="{DynamicResource ListBoxItemContainerStyle}"
>