Update to match article

This commit is contained in:
MeshackMusundi 2020-08-25 23:00:17 +03:00
parent 30d5fdbce8
commit 658517540e
3 changed files with 20 additions and 15 deletions

View File

@ -2,7 +2,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CompactNavigationMenu"
xmlns:views="clr-namespace:CompactNavigationMenu.Views"
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
StartupUri="MainWindow.xaml">
<Application.Resources>
<SolidColorBrush x:Key="PrimaryDarkBrush" Color="#FF0D2738"/>
@ -92,5 +94,21 @@
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
<x:Array x:Key="NavigationMenuItems" Type="system:String">
<system:String>Home</system:String>
<system:String>Email</system:String>
<system:String>Cloud</system:String>
</x:Array>
<DataTemplate x:Key="HomeViewTemplate">
<views:HomeView/>
</DataTemplate>
<DataTemplate x:Key="EmailViewTemplate">
<views:EmailView/>
</DataTemplate>
<DataTemplate x:Key="CloudViewTemplate">
<views:CloudView/>
</DataTemplate>
</Application.Resources>
</Application>

View File

@ -10,16 +10,6 @@
Title="Nav" WindowStartupLocation="CenterScreen">
<Window.Resources>
<DataTemplate x:Key="HomeViewTemplate">
<views:HomeView/>
</DataTemplate>
<DataTemplate x:Key="EmailViewTemplate">
<views:EmailView/>
</DataTemplate>
<DataTemplate x:Key="CloudViewTemplate">
<views:CloudView/>
</DataTemplate>
<Style x:Key="NavigationContentStyle" TargetType="ContentControl">
<Setter Property="ContentTemplate" Value="{StaticResource HomeViewTemplate}"/>
<Style.Triggers>
@ -43,8 +33,9 @@
<ListBox x:Name="NavigationMenuListBox"
Style="{StaticResource NavigationListBoxStyle}"
ItemContainerStyle="{DynamicResource NavigationListBoxItemStyle}"
ItemTemplate="{DynamicResource NavigationDataTemplate}"
ItemContainerStyle="{DynamicResource NavigationListBoxItemStyle}"/>
ItemsSource="{StaticResource NavigationMenuItems}"/>
<ContentControl Grid.Column="1" Style="{StaticResource NavigationContentStyle}"/>
</Grid>

View File

@ -10,10 +10,6 @@ namespace CompactNavigationMenu
public MainWindow()
{
InitializeComponent();
NavigationMenuListBox.Items.Add("Home");
NavigationMenuListBox.Items.Add("Email");
NavigationMenuListBox.Items.Add("Cloud");
}
}
}