Click here to Skip to main content
15,885,546 members
Articles / Web Development / HTML

Signum Framework Tutorials Part 2 – Southwind Logic

Rate me:
Please Sign up or sign in to vote.
4.45/5 (6 votes)
15 Nov 2012LGPL325 min read 31.3K   1K   22  
In this part, we will focus on writing business logic, LINQ queries and explain inheritance
<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero">
			<LinearGradientBrush x:Key="MenuItemSelectionFill" EndPoint="0,1" StartPoint="0,0">
			<GradientStop Color="#CCFDF8E5" Offset="0.008"/>
			<GradientStop Color="#CCFCE8A4" Offset="1"/>
		</LinearGradientBrush>
		<Geometry x:Key="Checkmark">M 0,5.1 L 1.7,5.2 L 3.4,7.1 L 8,0.4 L 9.2,0 L 3.3,10.8 Z</Geometry>
		<LinearGradientBrush x:Key="MenuBackground" EndPoint="0,1" StartPoint="0,0">
			<GradientStop Color="#FFF1F6F8" Offset="0"/>
			<GradientStop Color="#FFDFEDF9" Offset="1"/>
		</LinearGradientBrush>
		<LinearGradientBrush x:Key="MenuItemPressedFill" EndPoint="0,1" StartPoint="0,0">
			<GradientStop Color="#28717070" Offset="0"/>
			<GradientStop Color="#50717070" Offset="0.75"/>
			<GradientStop Color="#90717070" Offset="1"/>
		</LinearGradientBrush>
		<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
			<Grid SnapsToDevicePixels="true">
				<Rectangle x:Name="Bg" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="2" RadiusY="2"/>
				<Rectangle x:Name="InnerBorder" RadiusX="2" RadiusY="2" Margin="1"/>
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition SharedSizeGroup="MenuItemIconColumnGroup" MinWidth="24" Width="Auto"/>
						<ColumnDefinition Width="4"/>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="37"/>
						<ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
						<ColumnDefinition Width="17"/>
					</Grid.ColumnDefinitions>
					<ContentPresenter x:Name="Icon" Margin="1" VerticalAlignment="Center" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Icon"/>
					<Border x:Name="GlyphPanel" Width="20" Height="20" Visibility="Hidden" BorderBrush="#FFE1C365" BorderThickness="1" CornerRadius="3" Background="{DynamicResource MenuItemSelectionFill}" Margin="2">
						<Path x:Name="Glyph" Fill="#FF190F00" FlowDirection="LeftToRight" Width="9" Height="11" Data="{StaticResource Checkmark}"/>
					</Border>
					<ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.Column="2" ContentSource="Header" RecognizesAccessKey="True"/>
					<TextBlock Margin="{TemplateBinding Padding}" Grid.Column="4" Text="{TemplateBinding InputGestureText}"/>
				</Grid>
			</Grid>
			<ControlTemplate.Triggers>
				<Trigger Property="Icon" Value="{x:Null}">
					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
				</Trigger>
				<Trigger Property="IsChecked" Value="true">
					<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
				</Trigger>
				<Trigger Property="IsHighlighted" Value="true">
					<Setter Property="Stroke" TargetName="Bg" Value="#FFE1C365"/>
					<Setter Property="Stroke" TargetName="InnerBorder" Value="#40FFFFFF"/>
					<Setter Property="Fill" TargetName="Bg" Value="{DynamicResource MenuItemSelectionFill}"/>
				</Trigger>
				<Trigger Property="IsEnabled" Value="false">
					<Setter Property="Foreground" Value="#FF9A9A9A"/>
					<Setter Property="Background" TargetName="GlyphPanel" Value="#EEE9E9"/>
					<Setter Property="BorderBrush" TargetName="GlyphPanel" Value="#DBD6D6"/>
					<Setter Property="Fill" TargetName="Glyph" Value="#848589"/>
				</Trigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>
		<Style x:Key="MenuScrollButton" BasedOn="{x:Null}" TargetType="{x:Type RepeatButton}">
			<Setter Property="ClickMode" Value="Hover"/>
			<Setter Property="MinWidth" Value="0"/>
			<Setter Property="MinHeight" Value="0"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type RepeatButton}">
						<DockPanel SnapsToDevicePixels="true" Background="Transparent">
							<Rectangle x:Name="R1" Fill="Transparent" Width="1" DockPanel.Dock="Right"/>
							<Rectangle x:Name="B1" Fill="Transparent" Height="1" DockPanel.Dock="Bottom"/>
							<Rectangle x:Name="L1" Fill="Transparent" Width="1" DockPanel.Dock="Left"/>
							<Rectangle x:Name="T1" Fill="Transparent" Height="1" DockPanel.Dock="Top"/>
							<ContentPresenter x:Name="ContentContainer" HorizontalAlignment="Center" Margin="2,2,2,2" VerticalAlignment="Center"/>
						</DockPanel>
						<ControlTemplate.Triggers>
							<Trigger Property="IsPressed" Value="true">
								<Setter Property="Fill" TargetName="R1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
								<Setter Property="Fill" TargetName="B1" Value="{DynamicResource {x:Static SystemColors.ControlLightLightBrushKey}}"/>
								<Setter Property="Fill" TargetName="L1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
								<Setter Property="Fill" TargetName="T1" Value="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}"/>
								<Setter Property="Margin" TargetName="ContentContainer" Value="3,3,1,1"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Geometry x:Key="UpArrow">M 0,4 L 3.5,0 L 7,4 Z</Geometry>
		<MenuScrollingVisibilityConverter x:Key="MenuScrollingVisibilityConverter"/>
		<Geometry x:Key="DownArrow">M 0,0 L 3.5,4 L 7,0 Z</Geometry>
		<Style x:Key="{ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}" BasedOn="{x:Null}" TargetType="{x:Type ScrollViewer}">
			<Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
			<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ScrollViewer}">
						<Grid SnapsToDevicePixels="true">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*"/>
							</Grid.ColumnDefinitions>
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto"/>
								<RowDefinition Height="*"/>
								<RowDefinition Height="Auto"/>
							</Grid.RowDefinitions>
							<Border Grid.Column="0" Grid.Row="1">
								<ScrollContentPresenter Margin="{TemplateBinding Padding}"/>
							</Border>
							<RepeatButton Style="{StaticResource MenuScrollButton}" Focusable="false" Grid.Column="0" Grid.Row="0" Command="{x:Static ScrollBar.LineUpCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
								<RepeatButton.Visibility>
									<MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="0">
										<Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
										<Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
										<Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
										<Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
									</MultiBinding>
								</RepeatButton.Visibility>
								<Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" Data="{StaticResource UpArrow}"/>
							</RepeatButton>
							<RepeatButton Style="{StaticResource MenuScrollButton}" Focusable="false" Grid.Column="0" Grid.Row="2" Command="{x:Static ScrollBar.LineDownCommand}" CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}">
								<RepeatButton.Visibility>
									<MultiBinding FallbackValue="Visibility.Collapsed" Converter="{StaticResource MenuScrollingVisibilityConverter}" ConverterParameter="100">
										<Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
										<Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
										<Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
										<Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
									</MultiBinding>
								</RepeatButton.Visibility>
								<Path Fill="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}" Data="{StaticResource DownArrow}"/>
							</RepeatButton>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<SolidColorBrush x:Key="MenuBorderStroke" Color="#FF84A5CB"/>
		<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}" TargetType="{x:Type ContentControl}">
			<Border BorderBrush="{DynamicResource MenuBorderStroke}" BorderThickness="1">
				<Border.Background>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FFF7F9FA" Offset="0"/>
						<GradientStop Color="#FFE3EFF6" Offset="1"/>
					</LinearGradientBrush>
				</Border.Background>
				<Grid>
					<Rectangle Fill="#7FC8E1FE" HorizontalAlignment="Left" Width="28"/>
					<ContentPresenter Margin="1" Grid.ColumnSpan="2"/>
				</Grid>
			</Border>
		</ControlTemplate>
		<SolidColorBrush x:Key="HighlightStroke" Color="#FFE1C365"/>
		<ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
			<Grid SnapsToDevicePixels="true">
				<Rectangle x:Name="OuterBorder" RadiusX="2" RadiusY="2"/>
				<Rectangle x:Name="Bg" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="1" RadiusY="1" Margin="1"/>
				<Rectangle x:Name="InnerBorder" Margin="2"/>
				<DockPanel>
					<ContentPresenter x:Name="Icon" Margin="4,0,6,0" VerticalAlignment="Center" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Icon"/>
					<Path x:Name="GlyphPanel" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight" Margin="7,0,0,0" VerticalAlignment="Center" Visibility="Collapsed" Data="{StaticResource Checkmark}"/>
					<ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True"/>
				</DockPanel>
				<Popup x:Name="PART_Popup" AllowsTransparency="true" HorizontalOffset="0" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" VerticalOffset="-1" Focusable="false">
					<Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
						<ContentControl x:Name="SubMenuBorder" IsTabStop="false" Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}}">
							<ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="true">
								<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle" Grid.IsSharedSizeScope="true"/>
							</ScrollViewer>
						</ContentControl>
					</Microsoft_Windows_Themes:SystemDropShadowChrome>
				</Popup>
			</Grid>
			<ControlTemplate.Triggers>
				<Trigger Property="IsSuspendingPopupAnimation" Value="true">
					<Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
				</Trigger>
				<Trigger Property="Icon" Value="{x:Null}">
					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
				</Trigger>
				<Trigger Property="IsChecked" Value="true">
					<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
				</Trigger>
				<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
					<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
					<Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
				</Trigger>
				<Trigger Property="IsHighlighted" Value="true">
					<Setter Property="Stroke" TargetName="OuterBorder" Value="#50FFFFFF"/>
					<Setter Property="Stroke" TargetName="InnerBorder" Value="#50FFFFFF"/>
					<Setter Property="Fill" TargetName="Bg" Value="{DynamicResource MenuItemSelectionFill}"/>
					<Setter Property="Stroke" TargetName="Bg" Value="{DynamicResource HighlightStroke}"/>
				</Trigger>
				<Trigger Property="IsKeyboardFocused" Value="true">
					<Setter Property="Stroke" TargetName="InnerBorder" Value="#50FFFFFF"/>
					<Setter Property="Fill" TargetName="Bg" Value="{DynamicResource MenuItemSelectionFill}"/>
					<Setter Property="Stroke" TargetName="Bg" Value="{DynamicResource HighlightStroke}"/>
				</Trigger>
				<Trigger Property="IsSubmenuOpen" Value="true"/>
				<Trigger Property="IsEnabled" Value="false">
					<Setter Property="Foreground" Value="#FF9A9A9A"/>
					<Setter Property="Fill" TargetName="GlyphPanel" Value="#848589"/>
				</Trigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>
		<ControlTemplate x:Key="{ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
			<Grid SnapsToDevicePixels="true">
				<Rectangle x:Name="OuterBorder" RadiusX="2" RadiusY="2"/>
				<Rectangle x:Name="Bg" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="1" RadiusY="1" Margin="1"/>
				<Rectangle x:Name="InnerBorder" Margin="2"/>
				<DockPanel>
					<ContentPresenter x:Name="Icon" Margin="4,0,6,0" VerticalAlignment="Center" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Icon"/>
					<Path x:Name="GlyphPanel" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight" Margin="7,0,0,0" VerticalAlignment="Center" Visibility="Collapsed" Data="{StaticResource Checkmark}"/>
					<ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Header" RecognizesAccessKey="True"/>
				</DockPanel>
			</Grid>
			<ControlTemplate.Triggers>
				<Trigger Property="Icon" Value="{x:Null}">
					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
				</Trigger>
				<Trigger Property="IsChecked" Value="true">
					<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
				</Trigger>
				<Trigger Property="IsHighlighted" Value="true">
					<Setter Property="Stroke" TargetName="Bg" Value="#90717070"/>
					<Setter Property="Stroke" TargetName="OuterBorder" Value="#50FFFFFF"/>
					<Setter Property="Stroke" TargetName="InnerBorder" Value="#50FFFFFF"/>
				</Trigger>
				<Trigger Property="IsKeyboardFocused" Value="true">
					<Setter Property="Stroke" TargetName="Bg" Value="#E0717070"/>
					<Setter Property="Fill" TargetName="Bg" Value="{StaticResource MenuItemPressedFill}"/>
					<Setter Property="Stroke" TargetName="InnerBorder" Value="#50747272"/>
				</Trigger>
				<Trigger Property="IsEnabled" Value="false">
					<Setter Property="Foreground" Value="#FF9A9A9A"/>
					<Setter Property="Fill" TargetName="GlyphPanel" Value="#848589"/>
				</Trigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>
		<Geometry x:Key="RightArrow">M 0,0 L 4,3.5 L 0,7 Z</Geometry>
		<ControlTemplate x:Key="{ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}" TargetType="{x:Type MenuItem}">
			<Grid SnapsToDevicePixels="true">
				<Rectangle x:Name="Bg" Fill="{TemplateBinding Background}" Stroke="{TemplateBinding BorderBrush}" StrokeThickness="1" RadiusX="2" RadiusY="2"/>
				<Rectangle x:Name="InnerBorder" Stroke="Transparent" StrokeThickness="1" RadiusX="2" RadiusY="2" Margin="1"/>
				<Grid>
					<Grid.ColumnDefinitions>
						<ColumnDefinition SharedSizeGroup="MenuItemIconColumnGroup" MinWidth="24" Width="Auto"/>
						<ColumnDefinition Width="4"/>
						<ColumnDefinition Width="*"/>
						<ColumnDefinition Width="37"/>
						<ColumnDefinition SharedSizeGroup="MenuItemIGTColumnGroup" Width="Auto"/>
						<ColumnDefinition Width="17"/>
					</Grid.ColumnDefinitions>
					<ContentPresenter x:Name="Icon" Margin="1" VerticalAlignment="Center" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" ContentSource="Icon"/>
					<Border x:Name="GlyphPanel" Margin="1" Width="22" Height="22" Visibility="Hidden" Background="#E6EFF4" BorderBrush="#CDD3E6" BorderThickness="1" CornerRadius="3">
						<Path x:Name="Glyph" Fill="#0C12A1" FlowDirection="LeftToRight" Width="9" Height="11" Data="{StaticResource Checkmark}"/>
					</Border>
					<ContentPresenter Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Grid.Column="2" ContentSource="Header" RecognizesAccessKey="True"/>
					<TextBlock Margin="{TemplateBinding Padding}" Visibility="Collapsed" Grid.Column="4" Text="{TemplateBinding InputGestureText}"/>
					<Path Fill="{TemplateBinding Foreground}" Margin="4,0,0,0" VerticalAlignment="Center" Grid.Column="5" Data="{StaticResource RightArrow}"/>
				</Grid>
				<Popup x:Name="PART_Popup" AllowsTransparency="true" HorizontalOffset="-2" IsOpen="{Binding IsSubmenuOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Right" PopupAnimation="{DynamicResource {x:Static SystemParameters.MenuPopupAnimationKey}}" VerticalOffset="-3" Focusable="false" Margin="0.25,0,-0.25,0">
					<Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
						<ContentControl x:Name="SubMenuBorder" IsTabStop="false" Template="{DynamicResource {ComponentResourceKey ResourceId=SubmenuContent, TypeInTargetAssembly={x:Type FrameworkElement}}}">
							<ScrollViewer Style="{DynamicResource {ComponentResourceKey ResourceId=MenuScrollViewer, TypeInTargetAssembly={x:Type FrameworkElement}}}" CanContentScroll="true">
								<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.DirectionalNavigation="Cycle" KeyboardNavigation.TabNavigation="Cycle" Grid.IsSharedSizeScope="true"/>
							</ScrollViewer>
						</ContentControl>
					</Microsoft_Windows_Themes:SystemDropShadowChrome>
				</Popup>
			</Grid>
			<ControlTemplate.Triggers>
				<Trigger Property="IsSuspendingPopupAnimation" Value="true">
					<Setter Property="PopupAnimation" TargetName="PART_Popup" Value="None"/>
				</Trigger>
				<Trigger Property="IsHighlighted" Value="true">
					<Setter Property="Stroke" TargetName="InnerBorder" Value="#66FFE400"/>
				</Trigger>
				<Trigger Property="Icon" Value="{x:Null}">
					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
				</Trigger>
				<Trigger Property="IsChecked" Value="true">
					<Setter Property="Visibility" TargetName="GlyphPanel" Value="Visible"/>
					<Setter Property="Visibility" TargetName="Icon" Value="Collapsed"/>
					<Setter Property="Background" TargetName="GlyphPanel" Value="#99EFD387"/>
					<Setter Property="BorderBrush" TargetName="GlyphPanel" Value="#FFE1C365"/>
				</Trigger>
				<Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
					<Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
					<Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
				</Trigger>
				<Trigger Property="IsHighlighted" Value="true">
					<Setter Property="Fill" TargetName="Bg" Value="{StaticResource MenuItemSelectionFill}"/>
					<Setter Property="Stroke" TargetName="Bg" Value="{DynamicResource HighlightStroke}"/>
				</Trigger>
				<Trigger Property="IsEnabled" Value="false">
					<Setter Property="Foreground" Value="#FF9A9A9A"/>
					<Setter Property="Background" TargetName="GlyphPanel" Value="#EEE9E9"/>
					<Setter Property="BorderBrush" TargetName="GlyphPanel" Value="#DBD6D6"/>
					<Setter Property="Fill" TargetName="Glyph" Value="#848589"/>
				</Trigger>
			</ControlTemplate.Triggers>
		</ControlTemplate>
		<Style x:Key="{x:Type MenuItem}" TargetType="{x:Type MenuItem}">
			<Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
			<Style.Triggers>
				<Trigger Property="Role" Value="TopLevelHeader">
					<Setter Property="Padding" Value="7,2,8,3"/>
					<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
				</Trigger>
				<Trigger Property="Role" Value="TopLevelItem">
					<Setter Property="Padding" Value="7,2,8,3"/>
					<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=TopLevelItemTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
				</Trigger>
				<Trigger Property="Role" Value="SubmenuHeader">
					<Setter Property="Padding" Value="2,3,2,3"/>
					<Setter Property="Template" Value="{DynamicResource {ComponentResourceKey ResourceId=SubmenuHeaderTemplateKey, TypeInTargetAssembly={x:Type MenuItem}}}"/>
				</Trigger>
				<Trigger Property="Role" Value="SubmenuItem">
					<Setter Property="Padding" Value="2,3,2,3"/>
				</Trigger>
			</Style.Triggers>
		</Style>
		<Style x:Key="{x:Type Menu}" TargetType="{x:Type Menu}">
			<Setter Property="Background" Value="{StaticResource MenuBackground}"/>
			<Setter Property="FontFamily" Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}"/>
			<Setter Property="FontSize" Value="{DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}"/>
			<Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}"/>
			<Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.MenuTextBrushKey}}"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Menu}">
						<Border SnapsToDevicePixels="true" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
							<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="{x:Type Separator}" TargetType="{x:Type Separator}">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Separator}">
						<Grid Margin="0,6,0,4" SnapsToDevicePixels="true">
							<Rectangle Fill="#FFC5DBFC" Margin="30,0,1,1" Height="1"/>
							<Rectangle Fill="#FFFAFAFA" Margin="30,1,1,0" Height="1"/>
						</Grid>
					</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.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Software Developer (Senior) Signum Software
Spain Spain
I'm Computer Scientist, one of the founders of Signum Software, and the lead developer behind Signum Framework.

www.signumframework.com

I love programming in C#, Linq, Compilers, Algorithms, Functional Programming, Computer Graphics, Maths...

Comments and Discussions