Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all
I want to create a User Control in wpf that contains a lable,a TextBox and a button as remove UserControl,
now i want a simple way to remove uc
Thanks to those who helped me.
Posted
Updated 3-Dec-12 0:34am
v4

Hi,

You can create delegate that will point to the parent window where you have placed your user control. when button is clicked delegate will call the method and subsequently it will remove control from the window.

hope this information is enough to get your work done.

Best luck
 
Share this answer
 
Comments
ARIA 5 3-Dec-12 3:02am    
thanks for u're solution,
can u demonstrate it with example,if possible
thanks a lot
AmitGajjar 3-Dec-12 3:04am    
i suggest you to try something by reading delegate. this is very simple one. let us know if you have any query but at lest try something.
It depends on what the container holding usercontrol.
C#
private void imgRemove_Click(object sender, RoutedEventArgs e)
       {
           ((WrapPanel)this.Parent).Children.Remove(this);
       }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900