整理代码
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:assists="clr-namespace:Melskin.Assists"
|
||||
xmlns:controls="clr-namespace:Melskin.Controls"
|
||||
xmlns:converters="clr-namespace:Melskin.Converters"
|
||||
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Melskin;component/Themes/Animations.xaml" />
|
||||
@@ -12,7 +12,7 @@
|
||||
<ResourceDictionary Source="/Melskin;component/Controls/IconElement.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<Style TargetType="{x:Type Button}" x:Key="AlertCloseButtonStyle">
|
||||
<Style x:Key="AlertCloseButtonStyle" TargetType="{x:Type Button}">
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
@@ -33,7 +33,7 @@
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type controls:Alert}" x:Key="AlertBaseStyle">
|
||||
<Style x:Key="AlertBaseStyle" TargetType="{x:Type controls:Alert}">
|
||||
<Setter Property="Padding" Value="15,8" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
@@ -52,22 +52,22 @@
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="EmbossAlertStyle"
|
||||
BasedOn="{StaticResource AlertBaseStyle}"
|
||||
TargetType="{x:Type controls:Alert}"
|
||||
x:Key="EmbossAlertStyle">
|
||||
TargetType="{x:Type controls:Alert}">
|
||||
<Setter Property="assists:ShadingAssist.LightShadowBrush" Value="{DynamicResource LightShadowBrush}" />
|
||||
<Setter Property="assists:ShadingAssist.DarkShadowBrush" Value="{DynamicResource DarkShadowBrush}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:Alert}">
|
||||
<decorations:EmbossBorder
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
|
||||
DarkShadowBrush="{TemplateBinding assists:ShadingAssist.DarkShadowBrush}"
|
||||
Intensity="0.3"
|
||||
LightShadowBrush="{TemplateBinding assists:ShadingAssist.LightShadowBrush}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
UseLayoutRounding="True">
|
||||
<Grid>
|
||||
@@ -97,64 +97,64 @@
|
||||
Visibility="{Binding ShowIcon, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}" />
|
||||
</Viewbox>-->
|
||||
<controls:IconElement
|
||||
Foreground="{TemplateBinding IconBrush}"
|
||||
x:Name="Icon"
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Visibility="{Binding ShowIcon, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}"
|
||||
x:Name="Icon" />
|
||||
Foreground="{TemplateBinding IconBrush}"
|
||||
Visibility="{Binding ShowIcon, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}" />
|
||||
<!-- Message -->
|
||||
<ContentPresenter
|
||||
Content="{Binding Message, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Grid.Column="1"
|
||||
x:Name="Message"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
TextElement.Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="Message" />
|
||||
Content="{Binding Message, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
TextElement.Foreground="{DynamicResource TextPrimaryBrush}" />
|
||||
<!-- Description -->
|
||||
<ContentPresenter
|
||||
Content="{Binding Description, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
x:Name="Description"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
TextElement.Foreground="{DynamicResource TextSecondaryBrush}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Visibility="Collapsed"
|
||||
x:Name="Description" />
|
||||
Content="{Binding Description, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
TextElement.Foreground="{DynamicResource TextSecondaryBrush}"
|
||||
Visibility="Collapsed" />
|
||||
<!-- Close Button -->
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
x:Name="PART_Close"
|
||||
Grid.Row="0"
|
||||
Style="{StaticResource AlertCloseButtonStyle}"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Visibility="Collapsed"
|
||||
x:Name="PART_Close" />
|
||||
Style="{StaticResource AlertCloseButtonStyle}"
|
||||
Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</decorations:EmbossBorder>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Closable" Value="True">
|
||||
<Setter Property="Visibility" TargetName="PART_Close" Value="Visible" />
|
||||
<Setter TargetName="PART_Close" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<!-- With Description -->
|
||||
<DataTrigger Binding="{Binding Description, Mode=OneWay, RelativeSource={RelativeSource Self}, Converter={x:Static converters:NullOrEmptyConverter.Instance}}" Value="False">
|
||||
<Setter Property="Margin" TargetName="Message" Value="0,0,0,4" />
|
||||
<Setter Property="Visibility" TargetName="Description" Value="Visible" />
|
||||
<Setter Property="FontSize" TargetName="PART_Close" Value="14" />
|
||||
<Setter Property="TextElement.FontSize" TargetName="Message" Value="16" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="Message" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter TargetName="Message" Property="Margin" Value="0,0,0,4" />
|
||||
<Setter TargetName="Description" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="PART_Close" Property="FontSize" Value="14" />
|
||||
<Setter TargetName="Message" Property="TextElement.FontSize" Value="16" />
|
||||
<Setter TargetName="Message" Property="TextElement.Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
</DataTrigger>
|
||||
<Trigger Property="Type" Value="Info">
|
||||
<Setter Property="Symbol" TargetName="Icon" Value="Info" />
|
||||
<Setter TargetName="Icon" Property="Symbol" Value="Info" />
|
||||
</Trigger>
|
||||
<Trigger Property="Type" Value="Success">
|
||||
<Setter Property="Symbol" TargetName="Icon" Value="CheckCircle" />
|
||||
<Setter TargetName="Icon" Property="Symbol" Value="CheckCircle" />
|
||||
</Trigger>
|
||||
<Trigger Property="Type" Value="Warning">
|
||||
<Setter Property="Symbol" TargetName="Icon" Value="Warning" />
|
||||
<Setter TargetName="Icon" Property="Symbol" Value="Warning" />
|
||||
</Trigger>
|
||||
<Trigger Property="Type" Value="Error">
|
||||
<Setter Property="Symbol" TargetName="Icon" Value="Error" />
|
||||
<Setter TargetName="Icon" Property="Symbol" Value="Error" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -199,10 +199,10 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:Alert}">
|
||||
<Border
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
CornerRadius="{TemplateBinding assists:ControlAssist.CornerRadius}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
UseLayoutRounding="True">
|
||||
<Grid>
|
||||
@@ -222,64 +222,64 @@
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Icon -->
|
||||
<controls:IconElement
|
||||
Foreground="{TemplateBinding IconBrush}"
|
||||
x:Name="Icon"
|
||||
Margin="0,0,8,0"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Visibility="{Binding ShowIcon, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}"
|
||||
x:Name="Icon" />
|
||||
Foreground="{TemplateBinding IconBrush}"
|
||||
Visibility="{Binding ShowIcon, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}, Converter={x:Static converters:BooleanToVisibilityConverter.CollapsedInstance}}" />
|
||||
<!-- Message -->
|
||||
<ContentPresenter
|
||||
Content="{Binding Message, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Grid.Column="1"
|
||||
x:Name="Message"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
TextElement.Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="Message" />
|
||||
Content="{Binding Message, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
TextElement.Foreground="{DynamicResource TextPrimaryBrush}" />
|
||||
<!-- Description -->
|
||||
<ContentPresenter
|
||||
Content="{Binding Description, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
x:Name="Description"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
TextElement.Foreground="{DynamicResource TextSecondaryBrush}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Visibility="Collapsed"
|
||||
x:Name="Description" />
|
||||
Content="{Binding Description, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
TextElement.Foreground="{DynamicResource TextSecondaryBrush}"
|
||||
Visibility="Collapsed" />
|
||||
<!-- Close Button -->
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
x:Name="PART_Close"
|
||||
Grid.Row="0"
|
||||
Style="{StaticResource AlertCloseButtonStyle}"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Visibility="Collapsed"
|
||||
x:Name="PART_Close" />
|
||||
Style="{StaticResource AlertCloseButtonStyle}"
|
||||
Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="Closable" Value="True">
|
||||
<Setter Property="Visibility" TargetName="PART_Close" Value="Visible" />
|
||||
<Setter TargetName="PART_Close" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<!-- With Description -->
|
||||
<DataTrigger Binding="{Binding Description, Mode=OneWay, RelativeSource={RelativeSource Self}, Converter={x:Static converters:NullOrEmptyConverter.Instance}}" Value="False">
|
||||
<Setter Property="Margin" TargetName="Message" Value="0,0,0,4" />
|
||||
<Setter Property="Visibility" TargetName="Description" Value="Visible" />
|
||||
<Setter Property="FontSize" TargetName="PART_Close" Value="14" />
|
||||
<Setter Property="TextElement.FontSize" TargetName="Message" Value="16" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="Message" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter TargetName="Message" Property="Margin" Value="0,0,0,4" />
|
||||
<Setter TargetName="Description" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="PART_Close" Property="FontSize" Value="14" />
|
||||
<Setter TargetName="Message" Property="TextElement.FontSize" Value="16" />
|
||||
<Setter TargetName="Message" Property="TextElement.Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
</DataTrigger>
|
||||
<Trigger Property="Type" Value="Info">
|
||||
<Setter Property="Symbol" TargetName="Icon" Value="Info" />
|
||||
<Setter TargetName="Icon" Property="Symbol" Value="Info" />
|
||||
</Trigger>
|
||||
<Trigger Property="Type" Value="Success">
|
||||
<Setter Property="Symbol" TargetName="Icon" Value="CheckCircle" />
|
||||
<Setter TargetName="Icon" Property="Symbol" Value="CheckCircle" />
|
||||
</Trigger>
|
||||
<Trigger Property="Type" Value="Warning">
|
||||
<Setter Property="Symbol" TargetName="Icon" Value="Warning" />
|
||||
<Setter TargetName="Icon" Property="Symbol" Value="Warning" />
|
||||
</Trigger>
|
||||
<Trigger Property="Type" Value="Error">
|
||||
<Setter Property="Symbol" TargetName="Icon" Value="Error" />
|
||||
<Setter TargetName="Icon" Property="Symbol" Value="Error" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
Reference in New Issue
Block a user