WPF frame RemoveBackEntry

Site Index
あれこれやってみて妥協。前1ページは残して最新ページを表示するため Refresh と RemoveBackEntry を使用。







public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
int z_count = 0;
private void button1_Click(object sender, RoutedEventArgs e)
{
Window1 w_window = new Window1();
Page1 w_page = new Page1();
z_count++;
w_page.button1.Content = "Count " + z_count;
this.frame1.Content = w_page;
}
private void button2_Click(object sender, RoutedEventArgs e)
{
this.frame1.Content = null;
this.frame1.NavigationService.RemoveBackEntry();
this.frame1.Refresh();
}
private void button3_Click(object sender, RoutedEventArgs e)
{
Window1 w_window = new Window1();
Page1 w_page = new Page1();
z_count++;
w_page.button1.Content = "Count " + z_count;

this.frame1.Content = null;
this.frame1.NavigationService.RemoveBackEntry();
this.frame1.Refresh();

this.frame1.Content = w_page;
}
}






AX