|
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ContextMenuControls">
<Style TargetType="local:ContextMenu">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate x:Key="ContextMenuTemplate" TargetType="local:ContextMenu">
<Canvas x:Name="Root" Opacity="0">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="OpenStates">
<VisualStateGroup.Transitions>
<VisualTransition GeneratedDuration="0:0:0.2" />
</VisualStateGroup.Transitions>
<VisualState x:Name="Closed" />
<VisualState x:Name="Open">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border BorderBrush="Gray" BorderThickness="1" Width="150">
<Border.Effect>
<DropShadowEffect ShadowDepth="2" Color="Gray" />
</Border.Effect>
<ItemsControl x:Name="ItemList" Background="White" TabNavigation="Cycle" />
</Border>
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Default style for MenuItem -->
<Style TargetType="local:MenuItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:MenuItem">
<Grid Height="25" Background="#F0F0F0">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="Active">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="hoverBorder" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border Name="hoverBorder" Opacity="0" BorderBrush="#F0F0F0" BorderThickness="1" IsHitTestVisible="False" >
<Border Name="hoverBorder2" BorderBrush="#AECFF7" BorderThickness="1" CornerRadius="2">
<Rectangle Name="hoverRect" Fill="#ECF1F7" />
</Border>
</Border>
<TextBlock Text="{TemplateBinding Text}" Margin="3,2,2,2" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- Default style for MenuItemSeparator -->
<Style TargetType="local:MenuItemSeparator">
<Setter Property="Height" Value="1" />
<Setter Property="Margin" Value="0,4,0,4" />
<Setter Property="Background" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:MenuItemSeparator">
<Border BorderBrush="#888" BorderThickness="1" Background="#F0F0F0" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a software developer originally from Auckland, New Zealand. I have lived and worked in London since 2005.