1. .cs 文件
using System;
using System.Collections.Generic;
using System.Windows.Input;
using Windows.Foundation;
using Windows.UI;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Animation;
namespace CustomControlContainer.CustomControls
{
public class LeftMenuPane : ContentControl
{
private static readonly bool DefaultIsMenuOpen = false;
private static readonly Visibility DefaultInverseTapIconVisible = Visibility.Collapsed;
private static readonly Visibility DefaultContentVisible = Visibility.Visible;
private static readonly Color DefaultHeaderBackground = Color.FromArgb(255, 15, 111, 199);
#region Dependency properties defination
/// <summary>
/// The Header property displays at the top place, if user does set this value, the specific will not display.
/// </summary>
public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register("Header",
typeof(string),
typeof(LeftMenuPane),
null);
/// <summary>
/// The background of the header.
/// </summary>
public static readonly DependencyProperty HeaderBackgroundProperty = DependencyProperty.Register("HeaderBackground",
typeof(Brush),
typeof(LeftMenuPane),
new PropertyMetadata(new SolidColorBrush(DefaultHeaderBackground)));
/// <summary>
/// The property indicates whether is menu is open or not.
/// </summary>
public static readonly DependencyProperty IsMenuOpenProperty = DependencyProperty.Register("IsMenuOpen",
typeof(bool),
typeof(LeftMenuPane),
new PropertyMetadata(DefaultIsMenuOpen));
#endregion
#region Properties
public string Header
{
get { return (string)GetValue(HeaderProperty); }
set { SetValue(HeaderProperty, value); }
}
public Brush HeaderBackground
{
get { return (Brush)GetValue(HeaderBackgroundProperty); }
set { SetValue(HeaderBackgroundProperty, value); }
}
public bool IsMenuOpen
{
get { return (bool)GetValue(IsMenuOpenProperty); }
set { SetValue(IsMenuOpenProperty, value); }
}
#endregion
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
}
#region Private methods
public void MakeMenuOpen()
{
if (!this.IsMenuOpen)
{
VisualStateManager.GoToState(this, "SlideOutState", true);
}
this.IsMenuOpen = true;
}
public void MakeMenuClose()
{
if (this.IsMenuOpen)
{
VisualStateManager.GoToState(this, "SlideInState", true);
}
this.IsMenuOpen = false;
}
#endregion
}
}
2. XAML 样式布局
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:CustomControlContainer.CustomControls"
xmlns:Interactivity="using:Microsoft.Xaml.Interactivity"
xmlns:Core="using:Microsoft.Xaml.Interactions.Core"
xmlns:Media="using:Microsoft.Xaml.Interactions.Media" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
<Style x:Key="NavigationButton"
TargetType="Button">
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}" />
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Padding" Value="10,5,10,5" />
<Setter Property="FontWeight" Value="Light"/>
<Setter Property="Margin" Value="0,0,0,-7" />
<Setter Property="Width" Value="240" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Canvas.ZIndex" Value="1" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentContainer"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0"
Value="#666666" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonBackground"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0"
Value="DeepSkyBlue" />
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentContainer"
Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0"
Value="White" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid x:Name="ButtonBackground">
<ContentControl x:Name="ContentContainer"
HorizontalAlignment="Left"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Foreground="{TemplateBinding Foreground}"
Padding="{TemplateBinding Padding}" />
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="ButtonFont"
TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="FontFamily" Value="/Fonts/dynamsymb.ttf#Dynamics Symbol"/>
<Setter Property="FontSize" Value="24" />
</Style>
<Style x:Key="ButtonText"
TargetType="TextBlock">
<Setter Property="Margin" Value="10,0,0,0" />
<Setter Property="FontSize" Value="21" />
</Style>
<x:Double x:Key="NavigationBarWidth">200</x:Double>
<SolidColorBrush x:Key="DividingLineSolidColorBrush" Color="LightGray" />
<Style x:Key="MenuDividingLineStyle" TargetType="Line">
<Setter Property="Fill" Value="{StaticResource DividingLineSolidColorBrush}"/>
<Setter Property="Stroke" Value="{StaticResource DividingLineSolidColorBrush}"/>
<Setter Property="Y1" Value="2"/>
<Setter Property="Y2" Value="2"/>
<Setter Property="X2" Value="190"/>
</Style>
<!--Style for custom left menu pane-->
<Style TargetType="local:LeftMenuPane">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:LeftMenuPane">
<Grid x:Name="RootContent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="VisualStateGroup">
<VisualState x:Name="SlideOutState">
<Storyboard>
<ObjectAnimationUsingKeyFrames EnableDependentAnimation="True"
Storyboard.TargetProperty="Width"
Storyboard.TargetName="stackPanel">
<DiscreteObjectKeyFrame KeyTime="0:0:0.05" Value="40"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.10" Value="80"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.15" Value="120"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.20" Value="160"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.25" Value="190"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.30" Value="215"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.35" Value="230"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.40" Value="240"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="MenuHideFlag">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="MenuShowFlag">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ShadowBackground">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0.4"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ShadowBackground">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PopupView">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="SlideInState">
<Storyboard>
<ObjectAnimationUsingKeyFrames EnableDependentAnimation="True"
Storyboard.TargetProperty="Width"
Storyboard.TargetName="stackPanel">
<DiscreteObjectKeyFrame KeyTime="0:0:0.05" Value="200"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.10" Value="160"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.15" Value="120"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.20" Value="80"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.25" Value="50"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.30" Value="25"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.35" Value="10"/>
<DiscreteObjectKeyFrame KeyTime="0:0:0.40" Value="0"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="MenuHideFlag">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="MenuShowFlag">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ShadowBackground">
<EasingDoubleKeyFrame KeyTime="0" Value="0.4"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
</DoubleAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ShadowBackground">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
<DiscreteObjectKeyFrame KeyTime="0:0:0.4">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PopupView">
<DiscreteObjectKeyFrame KeyTime="0:0:0.4">
<DiscreteObjectKeyFrame.Value>
<Visibility>Collapsed</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Background="{TemplateBinding HeaderBackground}"
Grid.Row="0"
Height="50">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid x:Name="MenuHideFlag"
Height="50"
Width="50"
Background="Transparent">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuOpen"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<TextBlock Text=""
FontSize="{TemplateBinding FontSize}"
Foreground="White"
Style="{StaticResource ButtonFont}">
</TextBlock>
</Grid>
<Grid x:Name="MenuShowFlag"
Visibility="Collapsed"
Height="50"
Width="50"
Background="Transparent">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<TextBlock Text=""
Foreground="DeepSkyBlue"
Style="{StaticResource ButtonFont}"
FontSize="{TemplateBinding FontSize}"/>
</Grid>
<TextBlock Text="{TemplateBinding Header}"
VerticalAlignment="Center"
Grid.Column="1"
HorizontalAlignment="Left"
Foreground="White"
FontSize="{TemplateBinding FontSize}" />
</Grid>
<Grid Grid.Row="1">
<Grid Canvas.ZIndex="2" Visibility="Collapsed" x:Name="PopupView">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ScrollViewer Grid.Column="0" Background="White">
<StackPanel x:Name="stackPanel"
HorizontalAlignment="Left"
Width="0">
<Button Style="{StaticResource NavigationButton}"
Command="{Binding QuickAddCommand}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<Grid Margin="3">
<Ellipse Height="24" Width="24" StrokeThickness="3" Stroke="#FF5E95C1">
<Ellipse.Fill>
<ImageBrush Stretch="Fill"/>
</Ellipse.Fill>
</Ellipse>
<TextBlock Style="{StaticResource ButtonFont}"
FontSize="14"
Foreground="#FF5E95C1"
Text=""/>
</Grid>
<TextBlock Style="{StaticResource ButtonText}"
Text="Quick Add" />
</StackPanel>
</Button>
<Button Style="{StaticResource NavigationButton}"
Command="{Binding AppointmentCommand}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<TextBlock Style="{StaticResource ButtonFont}"
Text="" />
<TextBlock Style="{StaticResource ButtonText}"
Text="Appointments" />
</StackPanel>
</Button>
<Button Style="{StaticResource NavigationButton}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<TextBlock Style="{StaticResource ButtonFont}"
Text="" />
<TextBlock Style="{StaticResource ButtonText}"
Text="Customers" />
</StackPanel>
</Button>
<Button Style="{StaticResource NavigationButton}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<TextBlock Style="{StaticResource ButtonFont}"
Text="" />
<TextBlock Style="{StaticResource ButtonText}"
Text="Leads" />
</StackPanel>
</Button>
<Line Style="{StaticResource MenuDividingLineStyle}"/>
<Button Style="{StaticResource NavigationButton}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<TextBlock Style="{StaticResource ButtonFont}"
Text="" />
<TextBlock Style="{StaticResource ButtonText}"
Text="In Store Pickup" />
</StackPanel>
</Button>
<Button Style="{StaticResource NavigationButton}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<TextBlock Style="{StaticResource ButtonFont}"
Text="" />
<TextBlock Style="{StaticResource ButtonText}"
Text="Event Check-in" />
</StackPanel>
</Button>
<Line Style="{StaticResource MenuDividingLineStyle}"/>
<Button Style="{StaticResource NavigationButton}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<TextBlock Style="{StaticResource ButtonFont}"
Text="" />
<TextBlock Style="{StaticResource ButtonText}"
Text="Store Portal" />
</StackPanel>
</Button>
<Button Style="{StaticResource NavigationButton}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<TextBlock Style="{StaticResource ButtonFont}"
Text="" />
<TextBlock Style="{StaticResource ButtonText}"
Text="Retail Tasks" />
</StackPanel>
</Button>
<Button Style="{StaticResource NavigationButton}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<TextBlock Style="{StaticResource ButtonFont}"
Text="" />
<TextBlock Style="{StaticResource ButtonText}"
Text="Reports" />
</StackPanel>
</Button>
<Button Style="{StaticResource NavigationButton}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<TextBlock Style="{StaticResource ButtonFont}"
Text="" />
<TextBlock Style="{StaticResource ButtonText}"
Text="Helpdesk" />
</StackPanel>
</Button>
<Line Style="{StaticResource MenuDividingLineStyle}"/>
<Button Style="{StaticResource NavigationButton}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<TextBlock Style="{StaticResource ButtonFont}"
Text="" />
<TextBlock Style="{StaticResource ButtonText}"
Text="Settings" />
</StackPanel>
</Button>
<Button Style="{StaticResource NavigationButton}">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
<StackPanel HorizontalAlignment="Left"
Orientation="Horizontal">
<TextBlock Style="{StaticResource ButtonFont}"
Text="" />
<TextBlock Style="{StaticResource ButtonText}"
Text="Logout" />
</StackPanel>
</Button>
</StackPanel>
</ScrollViewer>
<Grid x:Name="ShadowBackground"
Grid.Column="1"
Opacity="0.4" Background="Black" VerticalAlignment="Stretch">
<Interactivity:Interaction.Behaviors>
<Core:EventTriggerBehavior EventName="Tapped">
<Core:CallMethodAction TargetObject="{Binding Mode=OneWay, RelativeSource={RelativeSource Mode=TemplatedParent}}" MethodName="MakeMenuClose"/>
</Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>
</Grid>
</Grid>
<Grid x:Name="grid" Background="Transparent">
<ContentPresenter Margin="6,10,6,0"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
x:Name="contentPresenter"/>
</Grid>
</Grid>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
3. 用法介绍
页面头部加入命名空间
xmlns:customControls="using:CustomControlContainer.CustomControls"
在页面根节点下放入
<customControls:LeftMenuPane FontSize="22" Header="Customer">
<!-- 你的页面内容-->
</customControls:LeftMenuPane>