private void Btn_NewVehicles_Click(object sender, System.Windows.RoutedEventArgs e) { viewNVcar = new ViewNewVehicles(); viewNVcar.RoleType = RoleType; viewNVcar.Department = Department; if (RoleType == "SalesMan" || RoleType == "Mechanic" || RoleType == "Surbordinate") { viewNVcar.can_Delete.Visibility = Visibility.Collapsed; _mainFrame.Navigate(viewNVcar); } else { _mainFrame.Navigate(viewNVcar); } }
private void Can_AddNewCar_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { ViewNewCar = new ViewNewVehicles(); AddNewCar = new AddNewVehicles(); ViewNewCar.NVehicle_page = null; DependencyObject currParent = VisualTreeHelper.GetParent(this); while (currParent != null && ViewNewCar.NVehicle_page == null) { ViewNewCar.NVehicle_page = currParent as Frame; currParent = VisualTreeHelper.GetParent(currParent); } if (ViewNewCar.NVehicle_page != null) { ViewNewCar.NVehicle_page.Source = new Uri("AddNewVehicles.xaml", UriKind.Relative); } }