tags:

views:

10

answers:

0

I need to create a navigation model where I can load content from listbox menu into frame and at the same time by clicking a usercontrol or a button in the loaded into frame page. I can successfully navigate by clicking menu items. However, I cannot do the same when I initiate page load into frame from already loaded page into frame. I am looking for the right technique to be able to achieve it.

Any advice is highly appreciated. Thank you.

Here is what I did so far:

I databind UriSource link from xml which is associated with items in the list box this way:

Below is the XAML code:

<Frame x:Name="ContentFrame" JournalOwnership="OwnsJournal" NavigationUIVisibility="Hidden" HorizontalAlignment="Left" Width="Auto" DataContext="{Binding SelectedItem, ElementName=Nav_ListBox, Mode=OneWay}" Source="{Binding XPath=UriSource}" />


<ListBox x:Name="Nav_ListBox" Margin="0,18,0,0" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Background="#FFF2F2F2" ItemsSource="{Binding Source={StaticResource PagesData}, XPath=page}"  />

I created a UserControl to be a container of the loaded data. Then, I generate repetitive content of the loaded page defined in xml. I also define UriSource associated with each item in xml I load into the page. Each item has unique UriSource.

<Grid.DataContext>
        <Binding Source="{StaticResource Dsh_DataSource}"/>
    </Grid.DataContext>

<Grid Margin="0,20,0,0">

 <UserControl>
 <ItemsControl x:Name="list" ItemsSource="{Binding XPath=/DS/Thumbnail}"> 
      <ItemsControl.ItemsPanel>
          <ItemsPanelTemplate>
              <WrapPanel Margin="0">
              </WrapPanel>
          </ItemsPanelTemplate>
      </ItemsControl.ItemsPanel>

      <ItemsControl.ItemTemplate>
          <DataTemplate x:Name="test">
           <local:ThumbUC Margin="0,0,14,35"/>

          </DataTemplate>
      </ItemsControl.ItemTemplate> 
 </ItemsControl>
</UserControl> 

</Grid>

It is all working fine with this model except clicking the content inside a loaded page. I added hyperlink in the usercontrol for testing purposed

<TextBlock FontSize="16" FontFamily="Segoe UI Light" TextOptions.TextRenderingMode="ClearType" Foreground="#FF007394" Style="{DynamicResource HyperlinkColoring}">
                        <Hyperlink NavigateUri="{Binding XPath=UriSource}"><Run Text="more…" /> 
                        </Hyperlink>
                        </TextBlock>

The application freezes on the click of that hyperlink. Obviously, this approach is wrong. What would be the correct way to databind frame source from multiple sources such as from listboxitem of the menu and from content generated inside the loaded page? Any advice is highly appreciated. Thank you.