WPF-การปิดปุ่ม Navigation ของ Browser
การปิดปุ่ม Navigation ของ Browser
ให้ทำการเพิ่ม Method Application_Navigating ในไฟล์ App.xaml.cs โดยเขียน Code ดังนี้
public partial class App : Application
{
private void Application_Navigating (object sender, NavigatingCancelEventArgs e)
{
if (e.NavigationMode != NavigationMode.New)
{
e.Cancel = true;
}
}
}
หลังจากนั้นใน Form อื่น ๆ ที่ต้องการเรียก Page อื่นให้ใช้ Code ดังนี้
pageChild newPage= new pageChild();
newPage.Variable = Value; ถ้ามี
NavigationService.Content = newPage;
และถ้าต้องการกลับไปยัง Page เดิมที่เรียกมา ให้เขียน Code ดังนี้
this.Content = null;
NavigationService.Content = new PageMaster();
แทนที่จะใช้ NavigationService.GoBack();

Comments
Post a Comment