208 lines
16 KiB
XML
208 lines
16 KiB
XML
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:controls="clr-namespace:HandyControl.Controls"
|
|
xmlns:langs="clr-namespace:HandyControl.Properties.Langs"
|
|
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
|
|
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="Button.xaml"/>
|
|
<ResourceDictionary Source="ToggleButton.xaml"/>
|
|
<ResourceDictionary Source="../Basic/Converters.xaml"/>
|
|
<ResourceDictionary Source="../Basic/Paths.xaml"/>
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
<Style x:Key="WindowDefaultStyle" BasedOn="{x:Null}" TargetType="{x:Type Window}">
|
|
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
|
</Style>
|
|
|
|
<Style x:Key="CustomWindowStyle" BasedOn="{x:Null}" TargetType="controls:WindowBorderless">
|
|
<Setter Property="Background" Value="White"/>
|
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
|
<Setter Property="UseLayoutRounding" Value="True"/>
|
|
<Setter Property="NoUserAreaBackground" Value="{DynamicResource PrimaryBrush}"/>
|
|
<Setter Property="NoUserAreaForeground" Value="White"/>
|
|
<Setter Property="CloseButtonHoverBrush" Value="Red"/>
|
|
<Setter Property="CloseButtonHoverForeground" Value="White"/>
|
|
<Setter Property="OtherButtonHoverBrush" Value="{DynamicResource DarkPrimaryBrush}"/>
|
|
<Setter Property="OtherButtonHoverForeground" Value="White"/>
|
|
<Setter Property="WindowChrome.WindowChrome">
|
|
<Setter.Value>
|
|
<WindowChrome CornerRadius="0" GlassFrameThickness="1" CaptionHeight="{Binding NoUserAreaHeight,RelativeSource={RelativeSource FindAncestor,AncestorType=controls:WindowBorderless}}"/>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="controls:WindowBorderless">
|
|
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
|
|
<Grid Margin="{TemplateBinding Padding}">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition/>
|
|
</Grid.RowDefinitions>
|
|
<Grid Visibility="{TemplateBinding IsFullScreen,Converter={StaticResource Boolean2VisibilityReConverter}}" Background="{TemplateBinding NoUserAreaBackground}" Name="GridMenu" TextElement.Foreground="{TemplateBinding NoUserAreaForeground}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<StackPanel WindowChrome.IsHitTestVisibleInChrome="True" UseLayoutRounding="True" VerticalAlignment="Top" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
|
<Button Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.MinimizeWindowCommand" IsTabStop="False" WindowChrome.IsHitTestVisibleInChrome="True" Name="ButtonMin" Height="28" Style="{StaticResource ButtonIcon}" Width="44" controls:IconElement.Geometry="{StaticResource WindowMinGeometry}" Padding="17,0"/>
|
|
<Button Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.MaximizeWindowCommand" IsTabStop="False" WindowChrome.IsHitTestVisibleInChrome="True" Name="ButtonMax" Height="28" Style="{StaticResource ButtonIcon}" Width="44" controls:IconElement.Geometry="{StaticResource WindowMaxGeometry}" Padding="17,0"/>
|
|
<Button Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.RestoreWindowCommand" IsTabStop="False" WindowChrome.IsHitTestVisibleInChrome="True" Name="ButtonRestore" Height="28" Style="{StaticResource ButtonIcon}" Width="44" controls:IconElement.Geometry="{StaticResource WindowRestoreGeometry}" Padding="17,0"/>
|
|
<Button Foreground="{TemplateBinding CloseButtonForeground}" Command="SystemCommands.CloseWindowCommand" IsTabStop="False" WindowChrome.IsHitTestVisibleInChrome="True" Name="ButtonClose" Height="28" Style="{StaticResource ButtonIcon}" Width="44" controls:IconElement.Geometry="{StaticResource CloseGeometry}" Padding="9"/>
|
|
</StackPanel>
|
|
<Grid Grid.Column="0">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
<ColumnDefinition/>
|
|
</Grid.ColumnDefinitions>
|
|
<ContentPresenter Content="{TemplateBinding Icon}" VerticalAlignment="Center"/>
|
|
<TextBlock Name="Title" Grid.Column="1" Text="{TemplateBinding Title}" Padding="10,0,0,0" VerticalAlignment="Center"/>
|
|
<ContentPresenter Grid.Column="2" x:Name="ContentPresenterMain" Content="{TemplateBinding NoUserContent}"/>
|
|
</Grid>
|
|
</Grid>
|
|
<ContentPresenter Grid.Row="1" Content="{TemplateBinding Content}"/>
|
|
<ResizeGrip x:Name="ResizeGrip" HorizontalAlignment="Right" VerticalAlignment="Bottom" Grid.Row="1" IsTabStop="False" Visibility="Collapsed" WindowChrome.ResizeGripDirection="BottomRight" />
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsActive" Value="False">
|
|
<Setter Property="Opacity" Value=".8" TargetName="ContentPresenterMain"/>
|
|
</Trigger>
|
|
<Trigger Property="WindowState" Value="Maximized">
|
|
<Setter Property="Padding" Value="8"/>
|
|
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonMax"/>
|
|
<Setter Property="Visibility" Value="Visible" TargetName="ButtonRestore"/>
|
|
</Trigger>
|
|
<Trigger Property="WindowState" Value="Normal">
|
|
<Setter Property="Visibility" Value="Visible" TargetName="ButtonMax"/>
|
|
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonRestore"/>
|
|
</Trigger>
|
|
<Trigger Property="ResizeMode" Value="NoResize">
|
|
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonMin"/>
|
|
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonMax"/>
|
|
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonRestore"/>
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True" SourceName="ButtonClose">
|
|
<Setter Property="Background" TargetName="ButtonClose" Value="{Binding CloseButtonHoverBrush,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
|
|
<Setter Property="Foreground" TargetName="ButtonClose" Value="{Binding CloseButtonHoverForeground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True" SourceName="ButtonMax">
|
|
<Setter Property="Background" TargetName="ButtonMax" Value="{Binding OtherButtonHoverBrush,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
|
|
<Setter Property="Foreground" TargetName="ButtonMax" Value="{Binding OtherButtonHoverForeground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True" SourceName="ButtonRestore">
|
|
<Setter Property="Background" TargetName="ButtonRestore" Value="{Binding OtherButtonHoverBrush,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
|
|
<Setter Property="Foreground" TargetName="ButtonRestore" Value="{Binding OtherButtonHoverForeground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True" SourceName="ButtonMin">
|
|
<Setter Property="Background" TargetName="ButtonMin" Value="{Binding OtherButtonHoverBrush,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
|
|
<Setter Property="Foreground" TargetName="ButtonMin" Value="{Binding OtherButtonHoverForeground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
|
|
</Trigger>
|
|
<Trigger Property="ShowNoUserArea" Value="False">
|
|
<Setter Property="Visibility" Value="Collapsed" TargetName="GridMenu"/>
|
|
</Trigger>
|
|
<Trigger Property="ShowTitle" Value="False">
|
|
<Setter Property="Visibility" Value="Collapsed" TargetName="Title"/>
|
|
</Trigger>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="ResizeMode" Value="CanResizeWithGrip"/>
|
|
<Condition Property="WindowState" Value="Normal" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter TargetName="ResizeGrip" Property="Visibility" Value="Visible" />
|
|
</MultiTrigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsFullScreen" Value="True">
|
|
<Setter Property="WindowChrome.WindowChrome">
|
|
<Setter.Value>
|
|
<WindowChrome CornerRadius="0" GlassFrameThickness="1" CaptionHeight="0"/>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style TargetType="controls:PopupWindow">
|
|
<Setter Property="WindowStyle" Value="None"/>
|
|
<Setter Property="MinHeight" Value="220"/>
|
|
<Setter Property="UseLayoutRounding" Value="True"/>
|
|
<Setter Property="BorderThickness" Value="20"/>
|
|
<Setter Property="ShowInTaskbar" Value="False"/>
|
|
<Setter Property="MinWidth" Value="300"/>
|
|
<Setter Property="ResizeMode" Value="NoResize"/>
|
|
<Setter Property="Background" Value="White"/>
|
|
<Setter Property="SizeToContent" Value="WidthAndHeight"/>
|
|
<Setter Property="Effect">
|
|
<Setter.Value>
|
|
<DropShadowEffect Opacity=".6" ShadowDepth="0" BlurRadius="15"/>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="controls:PopupWindow">
|
|
<Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto"/>
|
|
<RowDefinition/>
|
|
<RowDefinition Height="Auto"/>
|
|
</Grid.RowDefinitions>
|
|
<Grid Name="TitleGrid" Height="30" Background="{DynamicResource PrimaryBrush}">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition/>
|
|
<ColumnDefinition Width="Auto"/>
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock Name="PART_TitleBlock" Background="Transparent" Padding="10,6" FontSize="14" Foreground="White" Text="{TemplateBinding Title}" VerticalAlignment="Center" TextWrapping="Wrap" TextTrimming="WordEllipsis"/>
|
|
<Button Margin="0,0,1,0" Background="Transparent" Name="CloseButton" Foreground="White" Grid.Column="1" controls:BackgroundSwitchElement.MouseHoverBackground="Red" controls:BackgroundSwitchElement.MouseDownBackground="Red" Command="interactivity:ControlCommands.Close" IsCancel="True" Height="28" Style="{StaticResource ButtonCustom}" Width="44" controls:IconElement.Geometry="{StaticResource CloseGeometry}" Padding="9">
|
|
<Path Fill="{Binding ElementName=CloseButton,Path=Foreground}" Style="{StaticResource ClosePathStyle}"/>
|
|
</Button>
|
|
</Grid>
|
|
<Border BorderBrush="{DynamicResource PrimaryBrush}" Name="PART_MainBorder" Grid.Row="1">
|
|
<StackPanel>
|
|
<TextBlock Text="{TemplateBinding ContentStr}" MinHeight="110" Name="MyTextBlock" TextAlignment="Center" FontSize="16" Padding="32" Foreground="#252525" MaxWidth="300" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" Background="White"/>
|
|
<StackPanel Margin="0,0,0,32" Orientation="Horizontal" Background="White" HorizontalAlignment="Center">
|
|
<Button Command="interactivity:ControlCommands.Cancel" Visibility="{TemplateBinding ShowCancel,Converter={StaticResource Boolean2VisibilityConverter}}" Margin="0,0,16,0" Background="Transparent" Style="{StaticResource ButtonCustom}">
|
|
<Border BorderThickness="1" BorderBrush="{DynamicResource PrimaryBrush}" MinWidth="80" Height="30" CornerRadius="4" Background="White">
|
|
<TextBlock FontSize="16" Text="{x:Static langs:Lang.Cancel}" Foreground="{DynamicResource PrimaryBrush}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
</Border>
|
|
</Button>
|
|
<Button IsDefault="True" Command="interactivity:ControlCommands.Confirm" Background="Transparent" Style="{StaticResource ButtonCustom}">
|
|
<Border MinWidth="80" Height="30" CornerRadius="4" Background="{DynamicResource PrimaryBrush}">
|
|
<TextBlock FontSize="16" Text="{x:Static langs:Lang.Confirm}" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
|
</Border>
|
|
</Button>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
</Grid>
|
|
</Border>
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="ShowBorder" Value="True">
|
|
<Setter Property="BorderThickness" Value="1,0,1,1" TargetName="PART_MainBorder"/>
|
|
</Trigger>
|
|
<Trigger Property="ShowTitle" Value="False">
|
|
<Setter Property="Visibility" Value="Collapsed" TargetName="TitleGrid"/>
|
|
<Setter Property="Background" Value="Transparent"/>
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
|
|
<BeginStoryboard>
|
|
<Storyboard>
|
|
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:.2"/>
|
|
</Storyboard>
|
|
</BeginStoryboard>
|
|
</EventTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
</ResourceDictionary> |