// A click event handler for the complete order button void CompleteOrder(object sender, RoutedEventArgs e) { DependencyObject parent = this; do { parent = LogicalTreeHelper.GetParent(parent); } while (!(parent is MainWindow || parent is null)); if (parent is MainWindow menu) { PaymentOptionsScreen screen = new PaymentOptionsScreen(); screen.SetValue(Grid.ColumnSpanProperty, 2); menu.full.Children.Add(screen); menu.full.Children.Remove(this); } }
/// <summary> /// Click event for finishButton. Finishes entire order when button is clicked. /// </summary> /// <param name="sender">Reference to the object that raised the event.</param> /// <param name="e">Contains the event data.</param> void FinishOrder(object sender, RoutedEventArgs e) { PaymentOptionsScreen pos = new PaymentOptionsScreen((Order)DataContext); mscBorder.Child = pos; }