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
MainPage m = (MainPage)Application.Current.RootVisual;
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With