I got a problem. I added a frame in the window xaml to load pages in. I can directly load a page into frame with Source tag of the frame. It works. I need to use the code in C# to refer to the link from listbox menu a poplulate an apropriate link when an listbox item is selected. My problem is that I cannot refer the frame in C# code, it just cannot be seen. I defined the frame with x:Name="ContentFrame". When I refer to in in C#, Intellisense tells that "The name "ContentFrame" does not exist in the current context". What I am doing wrong? I am lost here. Any ideas are highly appreciated. Here is the code:
XAML:
<Frame x:Name="ContentFrame" JournalOwnership="OwnsJournal" NavigationUIVisibility="Hidden" Grid.Column="2" </Frame>
C#
` private void SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
ListBoxItem lbi = ((sender as ListBox).SelectedItem as ListBoxItem);
string itemName = lbi.Content.ToString();
if ( Nav_ListBox.SelectedItem.Equals("Page1" ) )
{
ContentFrame.Source = new Uri("Pages/Page1.xaml", UriKind.Relative);
Canvas_Frame.NavigationUIVisibility = NavigationUIVisibility.Hidden;
}
}
`