How to get Current AppLayout

I need to change MenuBar in AppLayout and add an item after the load view. How get AppLayout in ViewPage ? I try using getParent but it is null.

getParent() should work. My guess is are calling that in constructor when the view itself is not yet connected to the component hierarchy? I have a better alternative to getParent thought (no casting and the solution works with multiple parent layouts):

    @Override
    protected void onAttach(AttachEvent attachEvent) {
        super.onAttach(attachEvent);
        findAncestor(MainLayout.class) 
          .getNavigationMenu() // your custom method 
          // doStuffWithThings()
          ;
    }

thankssss…it works