整理代码
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
<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:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:controls="clr-namespace:Melskin.Controls">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Melskin;component/Controls/FlattenButton.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style TargetType="ListBoxItem" x:Key="TimePickerFlyoutListBoxItemStyle">
|
||||
<Style x:Key="TimePickerFlyoutListBoxItemStyle" TargetType="ListBoxItem">
|
||||
<Setter Property="Padding" Value="5,8" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
@@ -17,22 +17,22 @@
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
<Border
|
||||
x:Name="Bd"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{TemplateBinding Background}"
|
||||
CornerRadius="4"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="true"
|
||||
x:Name="Bd">
|
||||
SnapsToDevicePixels="true">
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
@@ -61,21 +61,21 @@
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Popup
|
||||
x:Name="TimePickerPopup"
|
||||
assists:BehaviorAssist.SimulateNativeBehavior="True"
|
||||
AllowsTransparency="True"
|
||||
Effect="{DynamicResource PopupShadow}"
|
||||
IsOpen="{Binding IsChecked, ElementName=PART_ToggleButton, Mode=TwoWay}"
|
||||
Placement="Bottom"
|
||||
PlacementTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}"
|
||||
PopupAnimation="Fade"
|
||||
StaysOpen="True"
|
||||
assists:BehaviorAssist.SimulateNativeBehavior="True"
|
||||
x:Name="TimePickerPopup">
|
||||
StaysOpen="True">
|
||||
<Border
|
||||
MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
|
||||
Margin="10"
|
||||
Background="{DynamicResource BackgroundFloatingBrush}"
|
||||
CornerRadius="8"
|
||||
Effect="{DynamicResource PopupShadow}"
|
||||
Margin="10"
|
||||
MinWidth="{Binding ActualWidth, ElementName=templateRoot}">
|
||||
Effect="{DynamicResource PopupShadow}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -87,44 +87,44 @@
|
||||
Margin="2"
|
||||
Orientation="Horizontal">
|
||||
<ListBox
|
||||
x:Name="HourSelector"
|
||||
Width="80"
|
||||
MaxHeight="240"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemContainerStyle="{StaticResource TimePickerFlyoutListBoxItemStyle}"
|
||||
MaxHeight="240"
|
||||
Width="80"
|
||||
x:Name="HourSelector" />
|
||||
ItemContainerStyle="{StaticResource TimePickerFlyoutListBoxItemStyle}" />
|
||||
<ListBox
|
||||
x:Name="MinuteSelector"
|
||||
Width="80"
|
||||
MaxHeight="240"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemContainerStyle="{StaticResource TimePickerFlyoutListBoxItemStyle}"
|
||||
MaxHeight="240"
|
||||
Width="80"
|
||||
x:Name="MinuteSelector" />
|
||||
ItemContainerStyle="{StaticResource TimePickerFlyoutListBoxItemStyle}" />
|
||||
<ListBox
|
||||
x:Name="PeriodSelector"
|
||||
Width="80"
|
||||
MaxHeight="240"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemContainerStyle="{StaticResource TimePickerFlyoutListBoxItemStyle}"
|
||||
MaxHeight="240"
|
||||
Width="80"
|
||||
x:Name="PeriodSelector" />
|
||||
ItemContainerStyle="{StaticResource TimePickerFlyoutListBoxItemStyle}" />
|
||||
</StackPanel>
|
||||
<Border
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="0,1,0,0"
|
||||
Grid.Row="1"
|
||||
Padding="5">
|
||||
Padding="5"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="0,1,0,0">
|
||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="AcceptButton"
|
||||
Style="{StaticResource FlattenButtonStyle}"
|
||||
ToolTip="Accept"
|
||||
x:Name="AcceptButton">
|
||||
ToolTip="Accept">
|
||||
<controls:IconElement Symbol="Check" />
|
||||
</Button>
|
||||
<Button
|
||||
x:Name="DismissButton"
|
||||
Margin="5,0,0,0"
|
||||
Style="{StaticResource FlattenButtonStyle}"
|
||||
ToolTip="Dismiss"
|
||||
x:Name="DismissButton">
|
||||
ToolTip="Dismiss">
|
||||
<controls:IconElement Symbol="Close" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
@@ -134,42 +134,42 @@
|
||||
</Popup>
|
||||
<!-- Header -->
|
||||
<ContentPresenter
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentSource="Header"
|
||||
Grid.Column="0"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="Center" />
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentSource="Header" />
|
||||
<!-- 使用ToggleButton作为点击触发器 -->
|
||||
<ToggleButton
|
||||
x:Name="PART_ToggleButton"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Cursor="Hand"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
x:Name="PART_ToggleButton">
|
||||
Cursor="Hand">
|
||||
<!-- 主显示区域 -->
|
||||
<Border HorizontalAlignment="Center" x:Name="ContentBorder">
|
||||
<Border x:Name="ContentBorder" HorizontalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
x:Name="HourTextBlock"
|
||||
Padding="0,0,6,0"
|
||||
Text="--"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="HourTextBlock" />
|
||||
Text="--" />
|
||||
<TextBlock
|
||||
Margin="4,0"
|
||||
Text=":"
|
||||
VerticalAlignment="Center" />
|
||||
<TextBlock
|
||||
Padding="6,0,0,0"
|
||||
Text="--"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="MinuteTextBlock" />
|
||||
Text=":" />
|
||||
<TextBlock
|
||||
x:Name="MinuteTextBlock"
|
||||
Padding="6,0,0,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="--" />
|
||||
<TextBlock
|
||||
x:Name="PeriodTextBlock"
|
||||
Margin="8,0"
|
||||
Text="AM"
|
||||
x:Name="PeriodTextBlock" />
|
||||
Text="AM" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</ToggleButton>
|
||||
@@ -183,8 +183,8 @@
|
||||
<Setter Property="Opacity" Value="0.5" />
|
||||
</Trigger>
|
||||
<Trigger Property="ClockIdentifier" Value="Clock24Hour">
|
||||
<Setter Property="Visibility" TargetName="PeriodTextBlock" Value="Collapsed" />
|
||||
<Setter Property="Visibility" TargetName="PeriodSelector" Value="Collapsed" />
|
||||
<Setter TargetName="PeriodTextBlock" Property="Visibility" Value="Collapsed" />
|
||||
<Setter TargetName="PeriodSelector" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
|
||||
Reference in New Issue
Block a user