整理代码
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:controls="clr-namespace:Melskin.Controls"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:Melskin.Controls">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="FlattenButton.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- 年月按钮 -->
|
||||
<Style TargetType="{x:Type CalendarButton}" x:Key="DefaultCalendarButtonStyle">
|
||||
<Style x:Key="DefaultCalendarButtonStyle" TargetType="{x:Type CalendarButton}">
|
||||
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
@@ -20,36 +20,36 @@
|
||||
<ControlTemplate TargetType="{x:Type CalendarButton}">
|
||||
<Grid>
|
||||
<Rectangle
|
||||
Fill="{DynamicResource ControlBackgroundSelectedBrush}"
|
||||
x:Name="SelectionMark"
|
||||
Margin="2"
|
||||
Fill="{DynamicResource ControlBackgroundSelectedBrush}"
|
||||
RadiusX="4"
|
||||
RadiusY="4"
|
||||
StrokeThickness="{TemplateBinding BorderThickness}"
|
||||
Visibility="Hidden"
|
||||
x:Name="SelectionMark" />
|
||||
Visibility="Hidden" />
|
||||
<Border
|
||||
x:Name="SelectedBorder"
|
||||
Margin="2"
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
CornerRadius="4"
|
||||
Margin="2"
|
||||
Visibility="Hidden"
|
||||
x:Name="SelectedBorder" />
|
||||
Visibility="Hidden" />
|
||||
<ContentPresenter
|
||||
x:Name="NormalText"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
TextElement.Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="NormalText" />
|
||||
TextElement.Foreground="{DynamicResource TextPrimaryBrush}" />
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="HasSelectedDays" Value="True">
|
||||
<Setter Property="Visibility" TargetName="SelectedBorder" Value="Visible" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="NormalText" Value="{DynamicResource TextAccentBrush}" />
|
||||
<Setter TargetName="SelectedBorder" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="NormalText" Property="TextElement.Foreground" Value="{DynamicResource TextAccentBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Visibility" TargetName="SelectionMark" Value="Visible" />
|
||||
<Setter Property="Background" TargetName="SelectedBorder" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
<Setter TargetName="SelectionMark" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="SelectedBorder" Property="Background" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsInactive" Value="True">
|
||||
<Setter Property="TextElement.Foreground" TargetName="NormalText" Value="{DynamicResource TextSecondaryBrush}" />
|
||||
<Setter TargetName="NormalText" Property="TextElement.Foreground" Value="{DynamicResource TextSecondaryBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -57,7 +57,7 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
<!-- 日期按钮 -->
|
||||
<Style TargetType="{x:Type CalendarDayButton}" x:Key="DefaultCalendarDayButtonStyle">
|
||||
<Style x:Key="DefaultCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
|
||||
<Setter Property="MinWidth" Value="28" />
|
||||
<Setter Property="MinHeight" Value="26" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
@@ -69,67 +69,67 @@
|
||||
<Grid>
|
||||
<!-- 选中背景 -->
|
||||
<Rectangle
|
||||
x:Name="SelectedBackground"
|
||||
Fill="{DynamicResource ControlBackgroundSelectedBrush}"
|
||||
RadiusX="4"
|
||||
RadiusY="4"
|
||||
Visibility="Hidden"
|
||||
x:Name="SelectedBackground" />
|
||||
Visibility="Hidden" />
|
||||
|
||||
<!-- 鼠标划过背景 -->
|
||||
<Rectangle
|
||||
x:Name="HighlightBackground"
|
||||
Fill="{DynamicResource ControlBackgroundHoverBrush}"
|
||||
RadiusX="4"
|
||||
RadiusY="4"
|
||||
Visibility="Hidden"
|
||||
x:Name="HighlightBackground" />
|
||||
Visibility="Hidden" />
|
||||
|
||||
<!-- 今日背景 -->
|
||||
<Rectangle
|
||||
x:Name="TodayBackground"
|
||||
Fill="{DynamicResource PrimaryNormalBrush}"
|
||||
RadiusX="4"
|
||||
RadiusY="4"
|
||||
Stroke="{DynamicResource PrimaryVariantBrush}"
|
||||
StrokeThickness="0"
|
||||
Visibility="Hidden"
|
||||
x:Name="TodayBackground" />
|
||||
Visibility="Hidden" />
|
||||
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
x:Name="NormalText"
|
||||
Margin="5,1,5,1"
|
||||
TextElement.Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
x:Name="NormalText" />
|
||||
TextElement.Foreground="{DynamicResource TextPrimaryBrush}" />
|
||||
<!-- 叉 -->
|
||||
<controls:IconElement
|
||||
Foreground="{DynamicResource ErrorBrush}"
|
||||
x:Name="Blackout"
|
||||
Margin="4"
|
||||
Foreground="{DynamicResource ErrorBrush}"
|
||||
Opacity="0"
|
||||
RenderTransformOrigin="0.5,0.5"
|
||||
Symbol="Close"
|
||||
x:Name="Blackout" />
|
||||
Symbol="Close" />
|
||||
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Visibility" TargetName="HighlightBackground" Value="Visible" />
|
||||
<Setter Property="Fill" TargetName="TodayBackground" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
<Setter TargetName="HighlightBackground" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="TodayBackground" Property="Fill" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="StrokeThickness" TargetName="TodayBackground" Value="1" />
|
||||
<Setter Property="Visibility" TargetName="SelectedBackground" Value="Visible" />
|
||||
<Setter TargetName="TodayBackground" Property="StrokeThickness" Value="1" />
|
||||
<Setter TargetName="SelectedBackground" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsToday" Value="True">
|
||||
<Setter Property="TextElement.Foreground" TargetName="NormalText" Value="#e0e0e0" />
|
||||
<Setter Property="Visibility" TargetName="TodayBackground" Value="Visible" />
|
||||
<Setter TargetName="NormalText" Property="TextElement.Foreground" Value="#e0e0e0" />
|
||||
<Setter TargetName="TodayBackground" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsBlackedOut" Value="True">
|
||||
<Setter Property="Visibility" TargetName="Blackout" Value="Visible" />
|
||||
<Setter TargetName="Blackout" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextDisabledBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsInactive" Value="True">
|
||||
<Setter Property="TextElement.Foreground" TargetName="NormalText" Value="{DynamicResource TextSecondaryBrush}" />
|
||||
<Setter TargetName="NormalText" Property="TextElement.Foreground" Value="{DynamicResource TextSecondaryBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -137,7 +137,7 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type CalendarItem}" x:Key="DefaultCalendarItemStyle">
|
||||
<Style x:Key="DefaultCalendarItemStyle" TargetType="{x:Type CalendarItem}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type CalendarItem}">
|
||||
@@ -145,23 +145,23 @@
|
||||
<!-- 星期标题 -->
|
||||
<DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}">
|
||||
<TextBlock
|
||||
Margin="0,6,0,6"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontFamily="Verdana"
|
||||
FontSize="12"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource PrimaryVariantBrush}"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0,6,0,6"
|
||||
Text="{Binding}"
|
||||
VerticalAlignment="Center" />
|
||||
Text="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ControlTemplate.Resources>
|
||||
<Grid x:Name="PART_Root">
|
||||
<Border
|
||||
Margin="4"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="8"
|
||||
Effect="{DynamicResource PopupShadow}"
|
||||
Margin="4">
|
||||
Effect="{DynamicResource PopupShadow}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="32" />
|
||||
@@ -174,56 +174,56 @@
|
||||
</Grid.RowDefinitions>
|
||||
<!-- 上方背景 -->
|
||||
<Border
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
CornerRadius="6,6,0,0"
|
||||
Grid.ColumnSpan="3"
|
||||
Margin="2" />
|
||||
Margin="2"
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
CornerRadius="6,6,0,0" />
|
||||
<!-- 向左按钮 -->
|
||||
<Button
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
Focusable="False"
|
||||
Grid.Column="0"
|
||||
x:Name="PART_PreviousButton"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="3"
|
||||
Padding="4"
|
||||
Style="{StaticResource FlattenButtonStyle}"
|
||||
x:Name="PART_PreviousButton">
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
Focusable="False"
|
||||
Style="{StaticResource FlattenButtonStyle}">
|
||||
<controls:IconElement Foreground="#e0e0e0" Symbol="ArrowBackIos" />
|
||||
</Button>
|
||||
<!-- 中间按钮 -->
|
||||
<Button
|
||||
x:Name="PART_HeaderButton"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="0,3"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
Focusable="False"
|
||||
FontSize="12"
|
||||
FontWeight="Bold"
|
||||
Foreground="#e0e0e0"
|
||||
Grid.Column="1"
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
Margin="0,3"
|
||||
Style="{StaticResource FlattenButtonStyle}"
|
||||
x:Name="PART_HeaderButton" />
|
||||
Style="{StaticResource FlattenButtonStyle}" />
|
||||
<!-- 右侧按钮 -->
|
||||
<Button
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
Focusable="False"
|
||||
Grid.Column="2"
|
||||
x:Name="PART_NextButton"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Margin="3"
|
||||
Padding="4"
|
||||
Style="{StaticResource FlattenButtonStyle}"
|
||||
x:Name="PART_NextButton">
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
Focusable="False"
|
||||
Style="{StaticResource FlattenButtonStyle}">
|
||||
<controls:IconElement Foreground="#e0e0e0" Symbol="ArrowForwardIos" />
|
||||
</Button>
|
||||
<!-- 月份视图 -->
|
||||
<Grid
|
||||
x:Name="PART_MonthView"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="6,2,6,6"
|
||||
Visibility="Visible"
|
||||
x:Name="PART_MonthView">
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="Visible">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -245,13 +245,13 @@
|
||||
</Grid>
|
||||
<!-- 年份视图 -->
|
||||
<Grid
|
||||
x:Name="PART_YearView"
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="3"
|
||||
Grid.Row="1"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="6,2,6,6"
|
||||
Visibility="Hidden"
|
||||
x:Name="PART_YearView">
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="Hidden">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -268,24 +268,24 @@
|
||||
</Border>
|
||||
<!-- 禁用遮罩 -->
|
||||
<Rectangle
|
||||
Fill="{DynamicResource ControlBackgroundDisabledBrush}"
|
||||
x:Name="PART_DisabledVisual"
|
||||
Margin="4"
|
||||
Fill="{DynamicResource ControlBackgroundDisabledBrush}"
|
||||
Opacity="0"
|
||||
RadiusX="6"
|
||||
RadiusY="6"
|
||||
Stretch="Fill"
|
||||
Visibility="Collapsed"
|
||||
x:Name="PART_DisabledVisual" />
|
||||
Visibility="Collapsed" />
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="CommonStates">
|
||||
<VisualState x:Name="Normal" />
|
||||
<VisualState x:Name="Disabled">
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Duration="0"
|
||||
Storyboard.TargetName="PART_DisabledVisual"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0.5" />
|
||||
To="0.5"
|
||||
Duration="0" />
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
@@ -293,15 +293,15 @@
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Visibility" TargetName="PART_DisabledVisual" Value="Visible" />
|
||||
<Setter TargetName="PART_DisabledVisual" Property="Visibility" Value="Visible" />
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Year">
|
||||
<Setter Property="Visibility" TargetName="PART_MonthView" Value="Hidden" />
|
||||
<Setter Property="Visibility" TargetName="PART_YearView" Value="Visible" />
|
||||
<Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
|
||||
<Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}" Value="Decade">
|
||||
<Setter Property="Visibility" TargetName="PART_MonthView" Value="Hidden" />
|
||||
<Setter Property="Visibility" TargetName="PART_YearView" Value="Visible" />
|
||||
<Setter TargetName="PART_MonthView" Property="Visibility" Value="Hidden" />
|
||||
<Setter TargetName="PART_YearView" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
@@ -309,7 +309,7 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type Calendar}" x:Key="DefaultCalendarStyle">
|
||||
<Style x:Key="DefaultCalendarStyle" TargetType="{x:Type Calendar}">
|
||||
<Setter Property="CalendarItemStyle" Value="{StaticResource DefaultCalendarItemStyle}" />
|
||||
<Setter Property="CalendarDayButtonStyle" Value="{StaticResource DefaultCalendarDayButtonStyle}" />
|
||||
<Setter Property="CalendarButtonStyle" Value="{StaticResource DefaultCalendarButtonStyle}" />
|
||||
@@ -319,13 +319,13 @@
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Calendar}">
|
||||
<StackPanel HorizontalAlignment="Center" x:Name="PART_Root">
|
||||
<StackPanel x:Name="PART_Root" HorizontalAlignment="Center">
|
||||
<CalendarItem
|
||||
x:Name="PART_CalendarItem"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Style="{TemplateBinding CalendarItemStyle}"
|
||||
x:Name="PART_CalendarItem" />
|
||||
Style="{TemplateBinding CalendarItemStyle}" />
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
@@ -334,9 +334,9 @@
|
||||
|
||||
<Style BasedOn="{StaticResource DefaultCalendarStyle}" TargetType="{x:Type Calendar}" />
|
||||
<Style
|
||||
x:Key="DefaultCalendarPickerStyle"
|
||||
BasedOn="{StaticResource DefaultCalendarStyle}"
|
||||
TargetType="{x:Type Calendar}"
|
||||
x:Key="DefaultCalendarPickerStyle">
|
||||
TargetType="{x:Type Calendar}">
|
||||
<Setter Property="Margin" Value="8" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user