views:

18

answers:

0

I have a two listboxes where I generate content from XML. I define UriSource in XML. I'd like to find out how I can update Frame's Source property from two different lisboxes. Any ideas are highly appreciated.

XAML:

Listboxes and Frame:

<Grid x:Name="PANEL_BottomArea_Grid"  DataContext="{Binding Source={StaticResource PagesData}}">
   <Grid.ColumnDefinitions>
    <ColumnDefinition Width="215"/>
    <ColumnDefinition Width="10"/>
    <ColumnDefinition Width="*"/>
   </Grid.ColumnDefinitions>

   <Grid Margin="0,0,1,0" DataContext="{Binding SelectedItem, ElementName=Nav_ListBox}">
    <ListBox x:Name="SubLevelMenuListbox" 
     ItemsSource="{Binding XPath=./*}" 
  Margin="{Binding XPath=@Margin}" 
  SelectedIndex="0"
  ItemContainerStyle="{DynamicResource SubLevelListBoxItemContainerStyle}" 
  />

    <Border x:Name="ListBoxBorder" Grid.Column="0" Margin="0" Background="#FFF3F3F3" 
   HorizontalAlignment="Left" >
     <ListBox x:Name="Nav_ListBox" 
      SelectedValuePath="@UriSource"
      SelectedIndex="0"
      ItemsSource="{Binding Source={StaticResource PagesData}, XPath=page}" 
      ItemContainerStyle="{DynamicResource ListBoxItemContainerStyle}" 
   />
    </Border>
   </Grid>
 <Frame Grid.Column="2" x:Name="ContentFrame" JournalOwnership="OwnsJournal" NavigationUIVisibility="Hidden" Width="Auto" Source="{Binding ElementName=Nav_ListBox, Path=SelectedValue, Mode=TwoWay, Converter={StaticResource UriConverter}}" />
  </Grid>

XML:

<?xml version="1.0" encoding="utf-8> <Pages> <page name="Name 1" UriSource="Pages/Name1.xaml"/> <page name="Name 2" UriSource="Pages/Name2.xaml"> <level2 name="ALL1" UriSource="Pages/All1.xaml"/> <level2 name="ALL2" UriSource="Pages/All2.xaml"/> <level2 name="ALL3" UriSource="Pages/All3.xaml"/> </page> <page name="Name 3" UriSource="Pages/Name3.xaml"/> <page name="Name 4" UriSource="Pages/Name4.xaml"/> </Pages>

Thank you.