Hi,
I have three pages, and to navigate to each page, I'm binding a property to the Source property of the Frame. It works pretty fine if I just navigate the pages normally, but after calling the GoBack method, the Frame suddenly stopped working. If I set a uri to the Source property directly instead of using binding, it works fine though, I'm actually implementing using MVVM, so I don't want to set the Source property directly.
--xaml--
<navigation:Frame x:Name="_frame" Source="{Binding CurrentPage}"/>
--Code behind--
Uri _currentPage;
public Uri CurrentPage
{
get { return _currentPage; }
set
{
_currentPage = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("CurrentPage"));
}
}
// back
private void Button_Click(object sender, RoutedEventArgs e)
{
if ( _frame.CanGoBack)
_frame.GoBack();
}
// test1
private void Button_Click_1(object sender, RoutedEventArgs e)
{
CurrentPage = new Uri("/TestPage1.xaml", UriKind.Relative);
}
// test2
private void Button_Click_2(object sender, RoutedEventArgs e)
{
CurrentPage = new Uri("/TestPage2.xaml", UriKind.Relative);
}
// test3
private void Button_Click_3(object sender, RoutedEventArgs e)
{
CurrentPage = new Uri("/TestPage3.xaml", UriKind.Relative);
}
Does anyone know how to work around this problem? I've tried several ways, but nothing works for me.
Thanks in advance,
Yoo