Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a top object (Window or Page) in WPF? [duplicate]

Within my custom WPF control I want to get a containing Window or Page. Window.GetWindow() method works fine when control is in a windowed app but when it's in the XBAP app in a browser it returns browser window instead of the page.

Is there any other way to do this?

like image 358
Alan Mendelevich Avatar asked May 08 '09 08:05

Alan Mendelevich


1 Answers

This works for me:

Window parentWindow = Window.GetWindow(this); 
like image 136
CompG33k Avatar answered Sep 29 '22 03:09

CompG33k