Search code examples
uwpxbox-one

How to control the visibility of a grid from child frame?


I am new to UWP and when I click a button inside the frame I need to open a screen on top of that from parent page.I have put the grid inside the frame and it worked but the opened page is not full screen. So I need to place the grid on the parent page and so that the opened (maybe change the visibility) is in full screen. Anyway to access parent element from inside of a frame? I have tried calling a parent function from frame and its execute but the grid visibility is not changed.Any idea?


Solution

  • within the constructor or onLoaded of your parent page, assign that Grid to a public static member;

    public static Grid PublicParentGrid;// this will be the static field within your parent page.
    
    public ParentPage()
    {
        InitializeComponent();
        PublicParentGrid = ParentGrid;// ParentGrid is the x:Name you defined for your grid.
    }
    

    now this publicparentgrid can be accessed from child page which is within the frame, like ParentPage.PublicParentGrid.Visibility .....