Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access parent window from User Control

Tags:

c#

.net

wpf

I am trying to access parent window from user control.

userControl1 uc1 = new userControl1();  mainGrid.Children.Add(uc1); 

through this code I load userControl1 to main grid.

But when I click on a button inside userControl1 then I want to load another userControl2 into mainGrid which is in main window?

like image 494
Lazy Lion Avatar asked Apr 26 '13 12:04

Lazy Lion


1 Answers

Have you tried

Window yourParentWindow = Window.GetWindow(userControl1); 
like image 129
Vlad Bezden Avatar answered Sep 22 '22 22:09

Vlad Bezden