提交记录修改UI/Controls/Select/DateSelect.cs+26 −1看文件
修改UI/Resources/Themes/Dark.xaml+3 −0看文件
修改UI/Resources/Themes/Light.xaml+6 −0看文件
修改UI/Themes/Select/DateSelect.xaml+121 −86看文件
| @@ -39,6 +39,7 @@ namespace UI.Controls.Select | ||
| 39 | 39 | return Day.Date > DateTime.Now.Date; |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 新增: public bool IsDisabled { get; set; } | |
| 42 | 43 | } |
| 43 | 44 | public class DateSelect : Control |
| 44 | 45 | { |
| @@ -311,13 +312,37 @@ namespace UI.Controls.Select | ||
| 311 | 312 | private void UpdateDays() |
| 312 | 313 | { |
| 313 | 314 | var list = new List<DayModel>(); |
| 315 | 新增: | |
| 316 | 新增: var startDay = new DateTime(Year, Month, 1); | |
| 317 | 新增: var startWeekNum = (int)startDay.DayOfWeek; | |
| 318 | 新增: startWeekNum = startWeekNum == 0 ? 7 : startWeekNum; | |
| 319 | 新增: startWeekNum -= 1; | |
| 320 | 新增: | |
| 321 | 新增: // 该月天数 | |
| 314 | 322 | int days = DateTime.DaysInMonth(Year, Month); |
| 323 | 新增: // 该月最后一天的日期 | |
| 324 | 新增: var lastDay = new DateTime(Year, Month, days); | |
| 325 | 新增: | |
| 326 | 新增: var preAppendDays = new List<DayModel>(); | |
| 327 | 新增: // 需要向前补日期 | |
| 328 | 新增: for (int i = startWeekNum; i > 0; i--) | |
| 329 | 新增: { | |
| 330 | 新增: var date = startDay.AddDays(-i); | |
| 331 | 新增: preAppendDays.Add(new DayModel() | |
| 332 | 新增: { | |
| 333 | 新增: Day = date.Date, | |
| 334 | 新增: IsDisabled = true, | |
| 335 | 新增: }); | |
| 336 | 新增: } | |
| 337 | 新增: list.AddRange(preAppendDays); | |
| 338 | 新增: | |
| 339 | 新增: // 当月日期 | |
| 315 | 340 | for (int i = 1; i < days + 1; i++) |
| 316 | 341 | { |
| 317 | 342 | list.Add(new DayModel() { Day = new DateTime(Year, Month, i).Date }); |
| 318 | 343 | } |
| 319 | 删除: Days = list; | |
| 320 | 344 | |
| 345 | 新增: Days = list; | |
| 321 | 346 | Day = list.Where(m => m.Day == SelectedDay).FirstOrDefault(); |
| 322 | 347 | } |
| 323 | 348 | |
| @@ -118,4 +118,7 @@ | ||
| 118 | 118 | <Color x:Key="PlaceholderRectBgFlashColor">#4d4d4d</Color> |
| 119 | 119 | <SolidColorBrush x:Key="PlaceholderRectBgFlashBrush" Color="{StaticResource PlaceholderRectBgFlashColor}" /> |
| 120 | 120 | |
| 121 | 新增: <Color x:Key="DisabledTextColor">#504f4f</Color> | |
| 122 | 新增: <SolidColorBrush x:Key="DisabledTextBrush" Color="{StaticResource DisabledTextColor}" /> | |
| 123 | 新增: | |
| 121 | 124 | </ResourceDictionary> |
| 文件末尾没有换行 | ||
| @@ -116,4 +116,10 @@ | ||
| 116 | 116 | <SolidColorBrush x:Key="PlaceholderRectBgBrush" Color="{StaticResource PlaceholderRectBgColor}" /> |
| 117 | 117 | <Color x:Key="PlaceholderRectBgFlashColor">#ffffff</Color> |
| 118 | 118 | <SolidColorBrush x:Key="PlaceholderRectBgFlashBrush" Color="{StaticResource PlaceholderRectBgFlashColor}" /> |
| 119 | 新增: | |
| 120 | 新增: | |
| 121 | 新增: <!--禁用颜色--> | |
| 122 | 新增: <Color x:Key="DisabledTextColor">#ccc</Color> | |
| 123 | 新增: <SolidColorBrush x:Key="DisabledTextBrush" Color="{StaticResource DisabledTextColor}" /> | |
| 124 | 新增: | |
| 119 | 125 | </ResourceDictionary> |
| 文件末尾没有换行 | ||
| @@ -3,6 +3,8 @@ | ||
| 3 | 3 | xmlns:local="clr-namespace:UI.Controls.Select" xmlns:base="clr-namespace:UI.Controls.Base" xmlns:button="clr-namespace:UI.Controls.Button" xmlns:converter="clr-namespace:UI.Controls.Converters"> |
| 4 | 4 | <converter:ToStringConverter x:Key="ToStringConverter"/> |
| 5 | 5 | |
| 6 | 新增: <SolidColorBrush x:Key="ThemeLightBrush" Color="{DynamicResource ThemeColor}" Opacity=".1"/> | |
| 7 | 新增: | |
| 6 | 8 | <Style TargetType="{x:Type local:DateSelect}"> |
| 7 | 9 | <Setter Property="SnapsToDevicePixels" |
| 8 | 10 | Value="true" /> |
| @@ -42,7 +44,7 @@ | ||
| 42 | 44 | CornerRadius="10" |
| 43 | 45 | BorderBrush="{DynamicResource PopupBorderBrush}" |
| 44 | 46 | BorderThickness="1" |
| 45 | 删除: Background="{DynamicResource StandardBackgroundBrush2}" Padding="10" MaxHeight="300" Margin="10"> | |
| 47 | 新增: Background="{DynamicResource PopupBackgroundBrush}" Padding="10" Margin="10"> | |
| 46 | 48 | <Border.Effect> |
| 47 | 49 | <DropShadowEffect BlurRadius="10" ShadowDepth="2" Direction="315" Color="Gray" Opacity=".1"/> |
| 48 | 50 | </Border.Effect> |
| @@ -63,15 +65,22 @@ | ||
| 63 | 65 | </Grid.ColumnDefinitions> |
| 64 | 66 | <!--年份选择--> |
| 65 | 67 | <StackPanel Orientation="Horizontal"> |
| 66 | 删除: <button:IconButton Icon="Back" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetYearCommand}" CommandParameter="-1"/> | |
| 67 | 删除: <TextBlock Width="50" Foreground="{DynamicResource StandardTextBrush}" TextAlignment="Center" Margin="5,0" VerticalAlignment="Center" Text="{TemplateBinding Year ,Converter= {StaticResource ToStringConverter}}"/> | |
| 68 | 删除: <button:IconButton Icon="Forward" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetYearCommand}" CommandParameter="1"/> | |
| 68 | 新增: <button:IconButton Icon="ChevronLeft" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetYearCommand}" CommandParameter="-1"/> | |
| 69 | 新增: <TextBlock Width="50" Foreground="{DynamicResource StandardTextBrush}" TextAlignment="Center" Margin="5,0" VerticalAlignment="Center" > | |
| 70 | 新增: <Run Text="{TemplateBinding Year ,Converter= {StaticResource ToStringConverter}}"/> | |
| 71 | 新增: <Run Text="年"/> | |
| 72 | 新增: </TextBlock> | |
| 73 | 新增: <button:IconButton Icon="ChevronRight" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetYearCommand}" CommandParameter="1"/> | |
| 69 | 74 | |
| 70 | 75 | </StackPanel> |
| 71 | 76 | <StackPanel Grid.Column="1" Orientation="Horizontal" x:Name="MonthSelect" Visibility="Collapsed"> |
| 72 | 删除: <button:IconButton Icon="Back" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetMonthCommand}" CommandParameter="-1"/> | |
| 73 | 删除: <TextBlock Width="30" Foreground="{DynamicResource StandardTextBrush}" TextAlignment="Center" Margin="5,0" VerticalAlignment="Center" Text="{TemplateBinding Month ,Converter= {StaticResource ToStringConverter}}"/> | |
| 74 | 删除: <button:IconButton Icon="Forward" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetMonthCommand}" CommandParameter="1"/> | |
| 77 | 新增: <button:IconButton Icon="ChevronLeft" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetMonthCommand}" CommandParameter="-1"/> | |
| 78 | 新增: <TextBlock Width="30" Foreground="{DynamicResource StandardTextBrush}" TextAlignment="Center" Margin="5,0" VerticalAlignment="Center"> | |
| 79 | 新增: <Run Text="{TemplateBinding Month ,Converter= {StaticResource ToStringConverter}}"/> | |
| 80 | 新增: <Run Text="月"/> | |
| 81 | 新增: </TextBlock> | |
| 82 | 新增: | |
| 83 | 新增: <button:IconButton Icon="ChevronRight" FontSize="12" VerticalAlignment="Center" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=SetMonthCommand}" CommandParameter="1"/> | |
| 75 | 84 | |
| 76 | 85 | </StackPanel> |
| 77 | 86 | </Grid> |
| @@ -79,92 +88,118 @@ | ||
| 79 | 88 | </Border> |
| 80 | 89 | <!--日选择--> |
| 81 | 90 | <Border Grid.Row="1" Width="250" x:Name="DaySelect" Visibility="Collapsed"> |
| 82 | 删除: <ListView ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=Days}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=Day,Mode=TwoWay}" Margin="0,10,0,0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" > | |
| 83 | 删除: <!--<i:Interaction.Triggers> | |
| 84 | 删除: <i:EventTrigger EventName="MouseLeftButtonUp"> | |
| 85 | 删除: <i:InvokeCommandAction Command="{Binding GotoDetailCommand}" | |
| 86 | 删除: CommandParameter="{Binding SelectedItem}" /> | |
| 87 | 删除: </i:EventTrigger> | |
| 88 | 删除: </i:Interaction.Triggers>--> | |
| 89 | 删除: <ListBox.Resources> | |
| 90 | 删除: <Style TargetType="{x:Type ListView}"> | |
| 91 | 删除: <Setter Property="OverridesDefaultStyle" Value="True"/> | |
| 92 | 删除: | |
| 93 | 删除: <Setter Property="Template"> | |
| 94 | 删除: <Setter.Value> | |
| 95 | 删除: <ControlTemplate TargetType="{x:Type ListView}"> | |
| 96 | 删除: <Border> | |
| 97 | 删除: <ItemsPresenter /> | |
| 98 | 删除: </Border> | |
| 99 | 删除: </ControlTemplate> | |
| 100 | 删除: </Setter.Value> | |
| 101 | 删除: </Setter> | |
| 102 | 删除: </Style> | |
| 103 | 删除: <Style TargetType="{x:Type ListViewItem}"> | |
| 104 | 删除: <Setter Property="OverridesDefaultStyle" Value="True"/> | |
| 105 | 删除: <Setter Property="Foreground" Value="{DynamicResource StandardTextBrush}"/> | |
| 106 | 删除: | |
| 107 | 删除: <Setter Property="Template"> | |
| 108 | 删除: <Setter.Value> | |
| 109 | 删除: <ControlTemplate TargetType="{x:Type ListViewItem}"> | |
| 110 | 删除: <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="{DynamicResource StandardBackgroundBrush}" Margin="0,0,0,0" Padding="0" Width="35" Height="35" CornerRadius="5"> | |
| 111 | 删除: <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/> | |
| 112 | 删除: </Border> | |
| 113 | 删除: <ControlTemplate.Triggers> | |
| 114 | 删除: <DataTrigger Binding="{Binding IsOut}" Value="True"> | |
| 115 | 删除: <Setter Property="Foreground" Value="#ccc"/> | |
| 116 | 删除: <Setter Property="IsEnabled" Value="False"/> | |
| 117 | 删除: </DataTrigger> | |
| 118 | 删除: <DataTrigger Binding="{Binding IsToday}" Value="True"> | |
| 119 | 删除: <Setter TargetName="Border" Property="Background" Value="#FFF2F1FF"/> | |
| 120 | 删除: <Setter Property="Foreground" Value="{DynamicResource ThemeBrush}"/> | |
| 121 | 删除: | |
| 122 | 删除: </DataTrigger> | |
| 123 | 删除: <Trigger Property="IsMouseOver" Value="True"> | |
| 124 | 删除: <Setter TargetName="Border" Property="Background" Value="{DynamicResource HoverBackgroundBrush}"/> | |
| 125 | 删除: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>--> | |
| 126 | 删除: | |
| 127 | 删除: </Trigger> | |
| 128 | 删除: <Trigger Property="IsSelected" Value="True"> | |
| 129 | 删除: <Setter TargetName="Border" Property="Background" Value="{DynamicResource ThemeBrush}"/> | |
| 130 | 删除: <Setter Property="Foreground" Value="White"/> | |
| 131 | 删除: | |
| 132 | 删除: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>--> | |
| 133 | 删除: | |
| 134 | 删除: </Trigger> | |
| 135 | 删除: </ControlTemplate.Triggers> | |
| 136 | 删除: </ControlTemplate> | |
| 137 | 删除: </Setter.Value> | |
| 138 | 删除: </Setter> | |
| 139 | 删除: | |
| 140 | 删除: </Style> | |
| 141 | 删除: </ListBox.Resources> | |
| 142 | 删除: <ListBox.ItemsPanel> | |
| 143 | 删除: <ItemsPanelTemplate> | |
| 144 | 删除: <WrapPanel/> | |
| 145 | 删除: </ItemsPanelTemplate> | |
| 146 | 删除: </ListBox.ItemsPanel> | |
| 147 | 删除: <ListView.ItemTemplate> | |
| 148 | 删除: <DataTemplate> | |
| 149 | 删除: | |
| 150 | 删除: <WrapPanel Orientation="Horizontal"> | |
| 151 | 删除: <Border > | |
| 152 | 删除: <!--<Grid> | |
| 91 | 新增: <Grid> | |
| 92 | 新增: <Grid.RowDefinitions> | |
| 93 | 新增: <RowDefinition Height="auto"/> | |
| 94 | 新增: <RowDefinition Height="auto"/> | |
| 95 | 新增: </Grid.RowDefinitions> | |
| 96 | 新增: <Border Grid.Row="0" Margin="0,15,0,0" BorderBrush="{DynamicResource SettingPanelSpliteLineBrush}" BorderThickness="0,0,0,.5" Padding="0,0,0,10"> | |
| 97 | 新增: <Grid > | |
| 98 | 新增: <Grid.ColumnDefinitions> | |
| 99 | 新增: <ColumnDefinition Width="35"/> | |
| 100 | 新增: <ColumnDefinition Width="35"/> | |
| 101 | 新增: <ColumnDefinition Width="35"/> | |
| 102 | 新增: <ColumnDefinition Width="35"/> | |
| 103 | 新增: <ColumnDefinition Width="35"/> | |
| 104 | 新增: <ColumnDefinition Width="35"/> | |
| 105 | 新增: <ColumnDefinition Width="35"/> | |
| 106 | 新增: </Grid.ColumnDefinitions> | |
| 107 | 新增: <TextBlock Grid.Column="0" Text="一" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/> | |
| 108 | 新增: <TextBlock Grid.Column="1" Text="二" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/> | |
| 109 | 新增: <TextBlock Grid.Column="2" Text="三" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/> | |
| 110 | 新增: <TextBlock Grid.Column="3" Text="四" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/> | |
| 111 | 新增: <TextBlock Grid.Column="4" Text="五" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/> | |
| 112 | 新增: <TextBlock Grid.Column="5" Text="六" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/> | |
| 113 | 新增: <TextBlock Grid.Column="6" Text="日" HorizontalAlignment="Center" Foreground="{DynamicResource SubTextBrush}"/> | |
| 114 | 新增: | |
| 115 | 新增: </Grid> | |
| 116 | 新增: </Border> | |
| 117 | 新增: <ListView Grid.Row="1" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=Days}" SelectedItem="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=Day,Mode=TwoWay}" Margin="0,10,0,0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" > | |
| 118 | 新增: <ListBox.Resources> | |
| 119 | 新增: <Style TargetType="{x:Type ListView}"> | |
| 120 | 新增: <Setter Property="OverridesDefaultStyle" Value="True"/> | |
| 121 | 新增: | |
| 122 | 新增: <Setter Property="Template"> | |
| 123 | 新增: <Setter.Value> | |
| 124 | 新增: <ControlTemplate TargetType="{x:Type ListView}"> | |
| 125 | 新增: <Border> | |
| 126 | 新增: <ItemsPresenter /> | |
| 127 | 新增: </Border> | |
| 128 | 新增: </ControlTemplate> | |
| 129 | 新增: </Setter.Value> | |
| 130 | 新增: </Setter> | |
| 131 | 新增: </Style> | |
| 132 | 新增: <Style TargetType="{x:Type ListViewItem}"> | |
| 133 | 新增: <Setter Property="OverridesDefaultStyle" Value="True"/> | |
| 134 | 新增: <Setter Property="Foreground" Value="{DynamicResource StandardTextBrush}"/> | |
| 135 | 新增: | |
| 136 | 新增: <Setter Property="Template"> | |
| 137 | 新增: <Setter.Value> | |
| 138 | 新增: <ControlTemplate TargetType="{x:Type ListViewItem}"> | |
| 139 | 新增: <Border BorderBrush="Transparent" BorderThickness="2" x:Name="Border" Background="Transparent" Margin="0,0,0,0" Padding="0" Width="35" Height="35" CornerRadius="5"> | |
| 140 | 新增: <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/> | |
| 141 | 新增: </Border> | |
| 142 | 新增: <ControlTemplate.Triggers> | |
| 143 | 新增: <DataTrigger Binding="{Binding IsOut}" Value="True"> | |
| 144 | 新增: <Setter Property="Foreground" Value="{DynamicResource DisabledTextBrush}"/> | |
| 145 | 新增: <Setter Property="IsEnabled" Value="False"/> | |
| 146 | 新增: </DataTrigger> | |
| 147 | 新增: <DataTrigger Binding="{Binding IsDisabled}" Value="True"> | |
| 148 | 新增: <Setter Property="Foreground" Value="{DynamicResource DisabledTextBrush}"/> | |
| 149 | 新增: <Setter Property="IsEnabled" Value="False"/> | |
| 150 | 新增: </DataTrigger> | |
| 151 | 新增: <DataTrigger Binding="{Binding IsToday}" Value="True"> | |
| 152 | 新增: <Setter TargetName="Border" Property="Background" Value="{StaticResource ThemeLightBrush}"/> | |
| 153 | 新增: <Setter Property="Foreground" Value="{DynamicResource ThemeBrush}"/> | |
| 154 | 新增: | |
| 155 | 新增: </DataTrigger> | |
| 156 | 新增: <Trigger Property="IsMouseOver" Value="True"> | |
| 157 | 新增: <Setter TargetName="Border" Property="Background" Value="{DynamicResource HoverBackgroundBrush}"/> | |
| 158 | 新增: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>--> | |
| 159 | 新增: | |
| 160 | 新增: </Trigger> | |
| 161 | 新增: <Trigger Property="IsSelected" Value="True"> | |
| 162 | 新增: <Setter TargetName="Border" Property="Background" Value="{DynamicResource ThemeBrush}"/> | |
| 163 | 新增: <Setter Property="Foreground" Value="White"/> | |
| 164 | 新增: | |
| 165 | 新增: <!--<Setter TargetName="Border" Property="BorderBrush" Value="#2b20d9"/>--> | |
| 166 | 新增: | |
| 167 | 新增: </Trigger> | |
| 168 | 新增: </ControlTemplate.Triggers> | |
| 169 | 新增: </ControlTemplate> | |
| 170 | 新增: </Setter.Value> | |
| 171 | 新增: </Setter> | |
| 172 | 新增: | |
| 173 | 新增: </Style> | |
| 174 | 新增: </ListBox.Resources> | |
| 175 | 新增: <ListBox.ItemsPanel> | |
| 176 | 新增: <ItemsPanelTemplate> | |
| 177 | 新增: <WrapPanel/> | |
| 178 | 新增: </ItemsPanelTemplate> | |
| 179 | 新增: </ListBox.ItemsPanel> | |
| 180 | 新增: <ListView.ItemTemplate> | |
| 181 | 新增: <DataTemplate> | |
| 182 | 新增: | |
| 183 | 新增: <WrapPanel Orientation="Horizontal"> | |
| 184 | 新增: <Border > | |
| 185 | 新增: <!--<Grid> | |
| 153 | 186 | <base:View Value="{Binding IsToday}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,-5,-5,0"> |
| 154 | 187 | <Rectangle RadiusX="10" RadiusY="10" Width="5" Height="5" Fill="Red"></Rectangle> |
| 155 | 188 | </base:View> |
| 156 | 189 | </Grid>--> |
| 157 | 删除: <TextBlock Text="{Binding DayText}" /> | |
| 190 | 新增: <TextBlock Text="{Binding DayText}" /> | |
| 158 | 191 | |
| 159 | 删除: </Border> | |
| 192 | 新增: </Border> | |
| 193 | 新增: | |
| 194 | 新增: </WrapPanel> | |
| 195 | 新增: | |
| 196 | 新增: </DataTemplate> | |
| 197 | 新增: </ListView.ItemTemplate> | |
| 198 | 新增: </ListView> | |
| 199 | 新增: </Grid> | |
| 160 | 200 | |
| 161 | 删除: </WrapPanel> | |
| 162 | 删除: | |
| 163 | 删除: </DataTemplate> | |
| 164 | 删除: </ListView.ItemTemplate> | |
| 165 | 删除: </ListView> | |
| 166 | 201 | </Border> |
| 167 | 删除: <Border Grid.Row="2" HorizontalAlignment="Right"> | |
| 202 | 新增: <Border Grid.Row="2" HorizontalAlignment="Right" Margin="0,10,0,0"> | |
| 168 | 203 | <StackPanel Orientation="Horizontal"> |
| 169 | 204 | <button:Button Content="确认" Width="100" Command="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:DateSelect}}, Path=DoneCommand}"/> |
| 170 | 205 | </StackPanel> |

