Hello,
I've placed in my MainWindow a StackPanel, which gets dynamically on runtime new UserControls (the UserControl is a row of TextBoxes and a button named "Delete"). This is about how I create the UserControls:
PersonObject p = new PersonObject;
List.Add(p);
UserControlLine usrCtrlLine = new UserControlLine();
usrCtrlLine.DataContext = p;
StackPanel.Children.Add(usrCtrlLine);
Now the UserControl contains Textboxes like this:
TextBox TextWrapping="Wrap" Grid.Column="1" Text="{Binding Path=Firstname, Mode=TwoWay}"
My questions are, how can I let the UserControl
- Remove itself from the StackPanel ("get deleted")
- Delete the PersonObject p which is bound to it?
Thanks a lot!