| 1 | <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 2 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | xmlns:local="clr-namespace:UI.Controls.DatePickerBar" |
| 4 | xmlns:base="clr-namespace:UI.Controls.Base" |
| 5 | xmlns:list="clr-namespace:UI.Controls.List"> |
| 6 | <Style TargetType="{x:Type local:DatePickerBar}"> |
| 7 | <Setter Property="SnapsToDevicePixels" |
| 8 | Value="true" /> |
| 9 | |
| 10 | <Setter Property="Background" Value="Transparent"/> |
| 11 | <Setter Property="Template"> |
| 12 | <Setter.Value> |
| 13 | <ControlTemplate TargetType="{x:Type local:DatePickerBar}"> |
| 14 | <Border> |
| 15 | <StackPanel> |
| 16 | <Grid x:Name="header"> |
| 17 | <Border |
| 18 | Width="{Binding ElementName=Date,Path=ActualWidth}" |
| 19 | Height="{Binding ElementName=Date,Path=ActualHeight}" |
| 20 | Background="{Binding ElementName=Date,Path=Background}" |
| 21 | CornerRadius="{Binding ElementName=Date,Path=CornerRadius}" |
| 22 | Padding="{Binding ElementName=Date,Path=Padding}" |
| 23 | Margin="{Binding ElementName=Date,Path=Margin}" |
| 24 | |
| 25 | HorizontalAlignment="Left" |
| 26 | > |
| 27 | <Border.Effect> |
| 28 | <DropShadowEffect Color="#d8d2d2" BlurRadius="1" Direction="300" ShadowDepth="4" Opacity="0.1" RenderingBias="Performance" ></DropShadowEffect> |
| 29 | </Border.Effect> |
| 30 | </Border> |
| 31 | <Border |
| 32 | x:Name="Date" |
| 33 | Background="{DynamicResource StandardBackgroundBrush}" |
| 34 | Padding="15,8" |
| 35 | CornerRadius="12" |
| 36 | Margin="0,0,0,10" |
| 37 | HorizontalAlignment="Left" |
| 38 | ToolTip="选择"> |
| 39 | |
| 40 | |
| 41 | |
| 42 | <StackPanel Orientation="Horizontal" > |
| 43 | <base:Icon x:Name="DateIcon" Margin="0,0,5,0" IconType="Calendar" Foreground="{DynamicResource StandardTextBrush}" VerticalAlignment="Center" HorizontalAlignment="Right"/> |
| 44 | |
| 45 | <TextBlock Foreground="{DynamicResource StandardTextBrush}" FontSize="15" Text="{TemplateBinding SelectedDateString}" Margin="0,0" VerticalAlignment="Center" HorizontalAlignment="Left"/> |
| 46 | <base:Icon x:Name="PopupIcon" Width="25" Height="25" Margin="10,0,0,0" FontSize="10" IconType="ChevronDown" VerticalAlignment="Center" HorizontalAlignment="Right"> |
| 47 | <base:Icon.RenderTransform> |
| 48 | <RotateTransform Angle="0" CenterX="12.5" CenterY="12.5"/> |
| 49 | </base:Icon.RenderTransform> |
| 50 | </base:Icon> |
| 51 | </StackPanel> |
| 52 | |
| 53 | </Border> |
| 54 | <Popup |
| 55 | x:Name="DatePickerPopup" |
| 56 | AllowsTransparency="True" |
| 57 | IsOpen="{TemplateBinding IsShowDatePickerPopup}" |
| 58 | Placement="Bottom" |
| 59 | PlacementTarget="{Binding ElementName=Date}" |
| 60 | PopupAnimation="Slide" |
| 61 | StaysOpen="False"> |
| 62 | <Border |
| 63 | Background="{DynamicResource StandardBackgroundBrush2}" |
| 64 | CornerRadius="12" |
| 65 | Padding="10" |
| 66 | Margin="10"> |
| 67 | <Border.Effect> |
| 68 | <DropShadowEffect BlurRadius="10" ShadowDepth="0" Direction="0" Color="Gray" Opacity=".2"/> |
| 69 | </Border.Effect> |
| 70 | |
| 71 | <Grid> |
| 72 | <Path |
| 73 | Width="15" |
| 74 | Height="15" |
| 75 | SnapsToDevicePixels="False" |
| 76 | Data="M 0 15 L 7.5 7.5 L 15 15" Fill="{DynamicResource StandardBackgroundBrush2}" |
| 77 | Stroke="{DynamicResource StandardBackgroundBrush2}" |
| 78 | StrokeThickness="1" |
| 79 | VerticalAlignment="Top" |
| 80 | HorizontalAlignment="Left" |
| 81 | Margin="0,-25,0,0" |
| 82 | /> |
| 83 | <StackPanel Orientation="Horizontal"> |
| 84 | |
| 85 | <StackPanel > |
| 86 | <TextBlock Text="年份" HorizontalAlignment="Center"/> |
| 87 | <list:BaseList x:Name="YearsList" Height="120" Margin="0,5,0,0"> |
| 88 | |
| 89 | </list:BaseList> |
| 90 | </StackPanel> |
| 91 | <StackPanel x:Name="MonthSelect" Margin="10,0,0,0" Visibility="Collapsed"> |
| 92 | <TextBlock Text="月份" HorizontalAlignment="Center"/> |
| 93 | <list:BaseList x:Name="MonthsList" Height="120" Margin="0,5,0,0" HorizontalAlignment="Center"> |
| 94 | |
| 95 | </list:BaseList> |
| 96 | </StackPanel> |
| 97 | |
| 98 | |
| 99 | </StackPanel> |
| 100 | |
| 101 | </Grid> |
| 102 | |
| 103 | </Border> |
| 104 | </Popup> |
| 105 | </Grid> |
| 106 | <Grid x:Name="ItemSelect"> |
| 107 | <Border Background="{DynamicResource StandardBackgroundBrush}" Padding="10" CornerRadius="10" Margin="0,10,0,0"> |
| 108 | <ScrollViewer x:Name="ScrollViewer" VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden"> |
| 109 | <StackPanel |
| 110 | Orientation="Horizontal" |
| 111 | x:Name="Container"> |
| 112 | |
| 113 | </StackPanel> |
| 114 | </ScrollViewer> |
| 115 | </Border> |
| 116 | </Grid> |
| 117 | </StackPanel> |
| 118 | |
| 119 | <VisualStateManager.VisualStateGroups> |
| 120 | <VisualStateGroup x:Name="CommonStates"> |
| 121 | <VisualStateGroup.Transitions> |
| 122 | <VisualTransition GeneratedDuration="0:0:0.18" /> |
| 123 | <VisualTransition GeneratedDuration="0" |
| 124 | To="Pressed" /> |
| 125 | </VisualStateGroup.Transitions> |
| 126 | <VisualState x:Name="Normal" /> |
| 127 | <VisualState x:Name="DateMouseOver"> |
| 128 | <Storyboard> |
| 129 | <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" |
| 130 | Storyboard.TargetName="Date"> |
| 131 | <EasingColorKeyFrame KeyTime="0" |
| 132 | Value="{DynamicResource HoverBackgroundColor}" /> |
| 133 | </ColorAnimationUsingKeyFrames> |
| 134 | </Storyboard> |
| 135 | </VisualState> |
| 136 | <VisualState x:Name="ShowPopup"> |
| 137 | <Storyboard> |
| 138 | <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(base:Icon.RenderTransform).(RotateTransform.Angle)" |
| 139 | Storyboard.TargetName="PopupIcon"> |
| 140 | <EasingDoubleKeyFrame KeyTime="0" |
| 141 | Value="-180" /> |
| 142 | |
| 143 | </DoubleAnimationUsingKeyFrames> |
| 144 | <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(base:Icon.Foreground).(SolidColorBrush.Color)" |
| 145 | Storyboard.TargetName="DateIcon"> |
| 146 | <EasingColorKeyFrame KeyTime="0" |
| 147 | Value="{DynamicResource ThemeColor}" /> |
| 148 | </ColorAnimationUsingKeyFrames> |
| 149 | </Storyboard> |
| 150 | </VisualState> |
| 151 | </VisualStateGroup> |
| 152 | </VisualStateManager.VisualStateGroups> |
| 153 | </Border> |
| 154 | <ControlTemplate.Triggers> |
| 155 | <Trigger Property="ShowType" Value="Year"> |
| 156 | <Setter TargetName="ItemSelect" Property="Visibility" Value="Collapsed"/> |
| 157 | </Trigger> |
| 158 | </ControlTemplate.Triggers> |
| 159 | </ControlTemplate> |
| 160 | </Setter.Value> |
| 161 | </Setter> |
| 162 | </Style> |
| 163 | </ResourceDictionary> |