Sunday, August 7, 2011

Hide WPF Frame Navigation Bar

Every time i used to create a Frame in WPF or Silverlight app i forgot how to hide the Navigation bar that appear on the top of the frame. So Everytime i need to open my previous project and need to see how i did it. Also there is not much help available on net some are asking write NavigationUIVisibility.Hidden on each page But I found a very Generic way of doing it.

Step 1.
In your Frame Tag Add the Event ContentRendered. as


 <Frame Name="myFrame" ContentRendered="myFrame_ContentRendered" ></Frame>

Step 2.
In the ContentRendered event handler set the  NavigationUIVisibility Hidden for each page instead on calling the same on all the pages as.


         private void myFrame_ContentRendered(object sender, EventArgs e)
        {
            myFrame.NavigationUIVisibility = System.Windows.Navigation.NavigationUIVisibility.Hidden;
        }


Hope it help lots of guys.
Thanks
Munish Bhargav