-1

I created a UserControl now I want to use several of these controls in stack panel

<StackPanel>
  <local:myUserControl/>
  <local:myUserControl/>
  <local:myUserControl/>
</StackPanel>

UserControl has a button that whene the user click on it, UserControl must be removed from the StackPanel.

How should I implement this?

git test
  • 408
  • 1
  • 5
  • 11

1 Answers1

1

use this code:

   ((Panel) this.Parent).Children.Remove(this);
Katana
  • 752
  • 4
  • 23