Sic.Framework-Nanjing-Baishi/MECF.Framework.RT.Core/Resources/LocalResource.xaml

264 lines
14 KiB
XML

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sw="clr-namespace:WpfStyleableWindow.StyleableWindow;assembly=MECF.Framework.Common">
<!-- the brushes used in the template (use these to customize the window look along with the window style (see the bottom of this file) -->
<SolidColorBrush x:Key="WindowColor" Color="Red" />
<SolidColorBrush x:Key="WindowBackColor" Color="LightBlue" />
<SolidColorBrush x:Key="WindowForeColor" Color="WhiteSmoke" />
<SolidColorBrush x:Key="WindowForeHighlightColor" Color="WhiteSmoke" />
<SolidColorBrush x:Key="WindowButtonColor" Color="DodgerBlue" />
<SolidColorBrush x:Key="WindowButtonOverColor" Color="LightBlue" />
<SolidColorBrush x:Key="WindowButtonPressedColor" Color="DarkBlue" />
<!-- -red window brushes -->
<!--<SolidColorBrush x:Key="WindowColor" Color="DarkRed"/>
<SolidColorBrush x:Key="WindowBackColor" Color="DarkRed"/>
<SolidColorBrush x:Key="WindowForeColor" Color="White"/>
<SolidColorBrush x:Key="WindowForeHighlightColor" Color="White"/>
<SolidColorBrush x:Key="WindowButtonColor" Color="OrangeRed"/>
<SolidColorBrush x:Key="WindowButtonOverColor" Color="Orange"/>
<SolidColorBrush x:Key="WindowButtonPressedColor" Color="DarkOrange"/>-->
<!-- The window template and it's components -->
<sw:WindowMinimizeCommand x:Key="MinimizeCommand" />
<sw:WindowMaximizeCommand x:Key="MaximizeCommand" />
<sw:WindowCloseCommand x:Key="CloseCommand" />
<Style x:Key="WindowButton" TargetType="{x:Type Button}">
<Setter Property="Height" Value="25" />
<Setter Property="Width" Value="25" />
<Setter Property="Background" Value="{StaticResource WindowButtonColor}" />
<Setter Property="Foreground" Value="{StaticResource WindowForeColor}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{StaticResource WindowButtonColor}" />
<Setter Property="Foreground" Value="{StaticResource WindowColor}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{StaticResource WindowButtonOverColor}" />
<Setter Property="Foreground" Value="{StaticResource WindowForeHighlightColor}" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{StaticResource WindowButtonPressedColor}" />
<Setter Property="Foreground" Value="{StaticResource WindowForeColor}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="WindowIcon" TargetType="{x:Type Image}">
<Setter Property="Height" Value="25" />
<Setter Property="Width" Value="25" />
</Style>
<ControlTemplate x:Key="WindowTemplate" TargetType="{x:Type Window}">
<Grid Background="{StaticResource WindowBackColor}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="5,0,5,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="75" />
</Grid.ColumnDefinitions>
<Label
Grid.Column="0"
Padding="0"
sw:ControlDoubleClickBehavior.ExecuteCommand="{StaticResource CloseCommand}"
sw:ControlDoubleClickBehavior.ExecuteCommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}">
<Image
Width="16"
sw:ShowSystemMenuBehavior.LeftButtonShowAt="{Binding ElementName=WindowContent}"
sw:ShowSystemMenuBehavior.TargetWindow="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
DockPanel.Dock="Left"
Source="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}, Path=Icon}"
Style="{StaticResource WindowIcon}" />
</Label>
<Label
Grid.Column="1"
Padding="3,0,0,0"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
sw:ControlDoubleClickBehavior.ExecuteCommand="{StaticResource MaximizeCommand}"
sw:ControlDoubleClickBehavior.ExecuteCommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
sw:ShowSystemMenuBehavior.RightButtonShow="true"
sw:ShowSystemMenuBehavior.TargetWindow="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
sw:WindowDragBehavior.LeftMouseButtonDrag="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
Content="{TemplateBinding Property=Title}"
DockPanel.Dock="Left"
FontSize="16"
Foreground="{StaticResource WindowForeColor}" />
<StackPanel Grid.Column="2" Orientation="Horizontal">
<Button
Command="{StaticResource MinimizeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
DockPanel.Dock="Right"
Style="{StaticResource WindowButton}">
_
</Button>
<Button
Command="{StaticResource MaximizeCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
DockPanel.Dock="Right"
Style="{StaticResource WindowButton}">
+
</Button>
<Button
Command="{StaticResource CloseCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
DockPanel.Dock="Right"
Style="{StaticResource WindowButton}">
X
</Button>
</StackPanel>
</Grid>
<Border
Grid.Row="1"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<AdornerDecorator>
<ContentPresenter x:Name="WindowContent" />
</AdornerDecorator>
<ResizeGrip
x:Name="WindowResizeGrip"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
IsTabStop="false"
Visibility="Collapsed" />
</Grid>
</Border>
</Grid>
<Thumb
x:Name="ThumbTop"
Height="6"
Margin="14,0"
VerticalAlignment="Top"
sw:WindowResizeBehavior.TopResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
Cursor="SizeNS"
Opacity="0" />
<Thumb
x:Name="ThumbTopLeft"
Width="6"
Height="6"
HorizontalAlignment="Left"
VerticalAlignment="Top"
sw:WindowResizeBehavior.TopLeftResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
Cursor="SizeNWSE"
Opacity="0" />
<Thumb
x:Name="ThumbBottom"
Height="6"
Margin="14,0"
VerticalAlignment="Bottom"
sw:WindowResizeBehavior.BottomResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
Cursor="SizeNS"
Opacity="0" />
<Thumb
x:Name="ThumbTopRight"
Width="6"
Height="6"
HorizontalAlignment="Right"
VerticalAlignment="Top"
sw:WindowResizeBehavior.TopRightResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
Cursor="SizeNESW"
Opacity="0" />
<Thumb
x:Name="ThumbRight"
Width="6"
Margin="0,14"
HorizontalAlignment="Right"
sw:WindowResizeBehavior.RightResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
Cursor="SizeWE"
Opacity="0" />
<Thumb
x:Name="ThumbBottomRight"
Width="6"
Height="6"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
sw:WindowResizeBehavior.BottomRightResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
Cursor="SizeNWSE"
Opacity="0" />
<Thumb
x:Name="ThumbLeft"
Width="6"
Margin="0,14"
HorizontalAlignment="Left"
sw:WindowResizeBehavior.LeftResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
Cursor="SizeWE"
Opacity="0" />
<Thumb
x:Name="ThumbBottomLeft"
Width="6"
Height="6"
HorizontalAlignment="Left"
VerticalAlignment="Bottom"
sw:WindowResizeBehavior.BottomLeftResize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"
Cursor="SizeNESW"
Opacity="0" />
</Grid>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="ResizeMode" Value="CanResizeWithGrip" />
<Condition Property="WindowState" Value="Normal" />
</MultiTrigger.Conditions>
<Setter TargetName="WindowResizeGrip" Property="Visibility" Value="Visible" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<!--
the custom window style and the window template
Here you can customize the look of the window without having to touch the control template
or comment out the brushes and create a new style (see the red style below)
-->
<Style x:Key="CustomWindowStyle" TargetType="{x:Type Window}">
<Setter Property="WindowStyle" Value="None" />
<Setter Property="AllowsTransparency" Value="True" />
<Setter Property="MinWidth" Value="200" />
<Setter Property="MinHeight" Value="46" />
<!-- CaptionHeight + ResizeBorderThickness * 2 -->
<Setter Property="Background" Value="LightGray" />
<Setter Property="BorderBrush" Value="DodgerBlue" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="Template" Value="{StaticResource WindowTemplate}" />
</Style>
<!-- the red style window -->
<Style x:Key="RedWindowStyle" TargetType="{x:Type Window}">
<Setter Property="WindowStyle" Value="None" />
<Setter Property="AllowsTransparency" Value="True" />
<Setter Property="MinWidth" Value="100" />
<Setter Property="MinHeight" Value="46" />
<Setter Property="Background" Value="white" />
<Setter Property="BorderBrush" Value="DarkRed" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="Foreground" Value="DarkGray" />
<Setter Property="Template" Value="{StaticResource WindowTemplate}" />
</Style>
</ResourceDictionary>