private void Btn_OldVehicles_Click(object sender, System.Windows.RoutedEventArgs e) { viewOldcar = new ViewOldVehicles(); viewOldcar.RoleType = RoleType; viewOldcar.Department = Department; if (RoleType == "SalesMan" || RoleType == "Mechanic" || RoleType == "Surbordinate") { viewOldcar.can_Delete.Visibility = Visibility.Collapsed; _mainFrame.Navigate(viewOldcar); } else { _mainFrame.Navigate(viewOldcar); } }
private void Can_AddOldCar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { ViewOldCar = new ViewOldVehicles(); AddOldCar = new AddOldVehicles(); ViewOldCar.OldVehicle_page = null; DependencyObject currParent = VisualTreeHelper.GetParent(this); while (currParent != null && ViewOldCar.OldVehicle_page == null) { ViewOldCar.OldVehicle_page = currParent as Frame; currParent = VisualTreeHelper.GetParent(currParent); } if (ViewOldCar.OldVehicle_page != null) { ViewOldCar.OldVehicle_page.Source = new Uri("AddOldVehicles.xaml", UriKind.Relative); } }