Accessing parent Moderntap page from a child

Jun 19, 2013 at 8:51 PM
Hi!
I need to add new tab to a moderntab page from within the child.
Can someone please help me with how I can achieve this.
Thanks
Jun 24, 2013 at 10:14 AM
Edited Jun 24, 2013 at 10:15 AM
// this <- your current child
ModernTab parentMT = 
    ((Grid)((ModernFrame)this.Parent).Parent).TemplatedParent as ModernTab; 
Link newLink = new Link()
{
    DisplayName = "NewTab",
    Source = new Uri("/YourPage.xaml", UriKind.Relative)
};
            
parentMT.Links.Add(newLink);