views:

172

answers:

2

Hi all,

I facing very huge problem now, that is I have usercontrol (created by me) which I have added on to a window... on click of button I wann show another usercontrol on window, total how can I access the window object in my control (usercontrol)

Thanks all

+1  A: 

You could do that by accessing the Parent property. But why not raising an event from the UserControl which is handled in the window, and there you add the other control?

Martin Moser
+1  A: 

You can use Window.GetWindow. However, you might want to consider a redesign where the Window is responsible for its content, not something hosted inside the Window.

HTH, Kent

HTH, Kent

Kent Boogaart