tags:

views:

235

answers:

2

Hello, I need to retrieve some control values from the MainPage to an UserControl. In this UserControl I need to be able to get the Frame.ActualWidth & Frame.ActualHeight values (in this case, the Frame element is in the MainPage and the UserControl is loaded inside a MainPage's Grid via xaml). Does someone have a sample? Thank you

Josimari Martarelli ESL Sistemas Logísticos Silverlight UI Design

[email protected]

+2  A: 

MainPage m = (MainPage)Application.Current.RootVisual;

xamlgeek
A: 

In instances like this I'll often use have my MainPage class have a public static reference to itself, Instance. I'll set it this "this" in the constructor and then when I need access to the MainPage from down in a user control I'll just call something like:

MainPage.Instance.Foo

Casey Margell