I have been using this code snippet for a while and I hope someone will find it useful. If you want to get the handle of the root page in Windows Phone application from any user control, here you go.
private static PhoneApplicationPage FindRootPage(FrameworkElement control)
{
if (control != null && !(control is PhoneApplicationPage))
{
control = FindRootPage(control.Parent as FrameworkElement);
}
return control as PhoneApplicationPage;
}
Tags: Root page, user control, WP