CREATING A HAMBURGER MENU FOR WINDOWS 10

And then finding out that there is a better way.. LOL!

I was like.. halfway into making a hamburger style menu for a Windows 10 app then I found Jerry Nixon’s blog. LOL!

Anyways, here is what I have:

This would be your Mainpage

<Page
x:Class=”splitview.MainPage”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”
xmlns:local=”using:splitview”
xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″
xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″
mc:Ignorable=”d”>
<StackPanel Orientation=”Horizontal”>
<SplitView x:Name=”svMine” CompactPaneLength=”45″DisplayMode=”CompactInline”>
<SplitView.Pane>
<StackPanel>
<StackPanel>
<Button x:Name=”btnView” Click=”btnView_Click” FontFamily=”Segoe MDL2 Assets” Content=””></Button >
</StackPanel>
<StackPanel>
<ListBox x:Name=”lstMenuItems”SelectionChanged=”lstMenuItems_SelectionChanged”>
<ListBoxItem x:Name=”opt1″ >
<StackPanel Orientation=”Horizontal”>
<TextBlock FontFamily=”Segoe MDL2 Assets”
Text=”” Tapped=”btnView_Click”></TextBlock>
<TextBlock Text=”Option 1″ Margin=”20,0,0,0″ />
</StackPanel>
</ListBoxItem>
<ListBoxItem x:Name=”opt2″ >
<StackPanel Orientation=”Horizontal”>
<TextBlock FontFamily=”Segoe MDL2 Assets” Text=””Tapped=”btnView_Click”></TextBlock>
<TextBlock Text=”Option 2″ Margin=”20,0,0,0″/>
</StackPanel>
</ListBoxItem>
</ListBox>
</StackPanel>
</StackPanel>
</SplitView.Pane>
<SplitView.Content>
<StackPanel>
<TextBlock x:Name=”txtselected”
Text=”Content 1″></TextBlock>
</StackPanel>
</SplitView.Content>
</SplitView>
</StackPanel>

</Page>

Then this is the code

public
sealed
partial
class
MainPage : Page

{
public MainPage()

{
this.InitializeComponent();

}
private
void btnView_Click(object sender, RoutedEventArgs e)

{

svMine.IsPaneOpen = !svMine.IsPaneOpen;

}
private
void lstMenuItems_SelectionChanged(object sender,SelectionChangedEventArgs e)

{

txtselected.Text = lstMenuItems.SelectedIndex.ToString();

}

}

There are a lot of other details inside like where I got that Font/Character. It is embedded in VS15 actually.

Oh well..

Advertisements
This entry was posted in Computers and Internet. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s