Answer the question
In order to leave comments, you need to log in
How to remove parent XAML element?
Started learning UWP with C#. There was a stupid problem.
I have something like this that plays when a button is clicked:
public void NewContent(object sender, RoutedEventArgs e){
StackPanel NewStack = new StackPanel();
DatePicker NewDatePicker = new DatePicker();
TextBox NewInputBox = new TextBox();
Button RemoveButton = new Button();
NewStack.Orientation = Orientation.Horizontal;
NewInputBox.Width = 120;
RemoveButton.Content = "-";
RemoveButton.Width = 40;
RemoveButton.Click += RemoveButton_Click;
NewStack.Children.Add(NewDatePicker);
NewStack.Children.Add(NewInputBox);
NewStack.Children.Add(RemoveButton);
MainStack.Children.Add(NewStack);}
RemoveButton.Parent.Remove()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question