'One Drive like' Navigation Drawer Layout for Windows Phone 8.1.
- swipe support
- landscape and RTL support (Credits:Konrad Bartecki https://github.com/konradbartecki)
-
Clone (download) the project
-
Add the project (or just the .cs file) to your existing solution
-
Add reference in your Windows Phone project
-
In your MainPage.xaml, add a namespace
xmlns:drawerLayout="using:DrawerLayout"
-
Replace the root Grid layout with the DrawerLayout
-
Create two child Grid controls inside the DrawerLayout. First control will contain the main content and the second will contain the navigation drawer. Your MainPage.xaml code should look like this:
<drawerLayout:DrawerLayout x:Name="DrawerLayout">
<Grid>
<!-- Main content goes here -->
</Grid>
<Grid>
<!-- Navigation Drwawer goes here -->
</Grid>
</drawerLayout:DrawerLayout>
The final step is to initialize the layout in your MainPage constructor:
public MainPage()
{
this.InitializeComponent();
DrawerLayout.InitializeDrawerLayout();
}
- IsDrawerOpened - returns true if drawer opened, else returns false.
-
InitializeDrawerLayout - initializes the drawer layout. Method must be called inside constructor.
-
OpenDrawer - opens the navigation drawer.
-
CloseDrawer - closes the navigation drawer.
Drawer Layout raises two (self explanatory) events:
-
DrawerOpened - raised when you swipe the drawer to the right or call OpenDrawer.
-
DrawerClosed - raises when you swipe the drawer to the left or call CloseDrawer.
Demo app on Windows Phone Store: http://www.windowsphone.com/s?appid=d0264913-cfa2-4273-91c5-8372a5347084
Tutorial available on http://www.c-sharpcorner.com/UploadFile/cb386b/implementing-navigation-drawer-for-windows-phone-8-1/
Navigation Drawer Layout is also available as NuGet Package https://www.nuget.org/packages/DrawerLayout/
For Silverlight version, check out the port on https://github.com/jgannaway/windows-phone-navigation-drawer
Credits: Jeremy Gannaway (https://github.com/jgannaway)