提交 802297fa 编写于 作者: 小时後可胖了's avatar 小时後可胖了

优化日历控件

上级 7235a888
......@@ -6,3 +6,4 @@ SmartUI/obj/
/.vs
/SmartUI/SmartUI.1.0.0.1.nupkg
/packages
/SmartUI
......@@ -15,7 +15,7 @@
3. Button样式
![image](https://user-images.githubusercontent.com/29591512/110083013-1ccc9480-7dc9-11eb-8c7d-336ce639d711.png)
使用方式:如果按钮需要显示图标则需加入附加属性assist:ButtonAssist.Icon="Search"
```` csharp
<UniformGrid Columns="7" Rows="6">
<Label Content="默认样式"/>
<Button Content="默认按钮"/>
......@@ -59,7 +59,7 @@
<Button Content="默认按钮" Style="{StaticResource TextButtonStyle}"/>
<Button Content="禁用按钮" IsEnabled="False" Style="{StaticResource TextButtonStyle}"/>
</UniformGrid>
````
3. SmartWindow自定义控件,全新的窗体界面
使用方式:将Window继承自SmartWindow即可
5. TabControl控件样式
......
......@@ -171,8 +171,7 @@
</WrapPanel>
<WrapPanel Orientation="Horizontal" Height="400">
<Label Content="时间控件"/>
<DatePicker Style="{StaticResource DatePickerDefault}"/>
<Calendar Width="300" Height="400"/>
<DatePicker DisplayDateStart="2021-3-18" Style="{StaticResource DatePickerDefault}"/>
</WrapPanel>
</StackPanel>
</ScrollViewer>
......
......@@ -76,6 +76,7 @@
<ItemGroup>
<Compile Include="Assist\ButtonAssist.cs" />
<Compile Include="Assist\DataGridAssist.cs" />
<Compile Include="Assist\DatePickerAssist.cs" />
<Compile Include="Controls\CascaderItem.cs" />
<Compile Include="Controls\Cascader.cs" />
<Compile Include="Controls\ChildWindow.cs" />
......
......@@ -39,15 +39,14 @@
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Duration="0"
To=".5"
<DoubleAnimation Duration="0" To=".5"
Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)"
Storyboard.TargetName="path" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid Background="Transparent">
<!--左箭头-->
<Path x:Name="path"
Data="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z"
......@@ -86,7 +85,7 @@
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid Background="Transparent">
<Path x:Name="path"
Data="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"
Fill="#999999"
......
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:smart="clr-namespace:SmartUI.Controls">
xmlns:assist="clr-namespace:SmartUI.Assist">
<PathGeometry x:Key="pathDate1">M544 703.872H612.48c10.24 0 17.152-7.04 17.152-17.728V615.36c0-10.624-6.848-17.664-17.152-17.664H544c-10.304 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.848 17.728 17.152 17.728z m0-176.96H612.48c10.24 0 17.152-7.04 17.152-17.728V438.4c0-10.624-6.848-17.664-17.152-17.664H544c-10.304 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.848 17.728 17.152 17.728z m171.392 0h68.608c10.24 0 17.152-7.04 17.152-17.728V438.4c0-10.624-6.912-17.664-17.152-17.664h-68.608c-10.24 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.912 17.728 17.152 17.728z m-342.848 0h68.608c10.24 0 17.088-7.04 17.088-17.728V438.4c0-10.624-6.848-17.664-17.088-17.664H372.48c-10.24 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.848 17.728 17.152 17.728z m342.848 176.96h68.608c10.24 0 17.152-7.04 17.152-17.728V615.36c0-10.624-6.912-17.664-17.152-17.664h-68.608c-10.24 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.912 17.728 17.152 17.728z m0 176.96h68.608c10.24 0 17.152-7.04 17.152-17.728V792.32c0-10.624-6.912-17.664-17.152-17.664h-68.608c-10.24 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.912 17.728 17.152 17.728z m-171.392 0H612.48c10.24 0 17.152-7.04 17.152-17.728V792.32c0-10.624-6.848-17.664-17.152-17.664H544c-10.304 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.848 17.728 17.152 17.728z m-342.848 0h68.544c10.24 0 17.152-7.04 17.152-17.728V792.32c0-10.624-6.848-17.664-17.152-17.664H201.152c-10.304 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.848 17.728 17.152 17.728z m0-176.96h68.544c10.24 0 17.152-7.04 17.152-17.728V615.36c0-10.624-6.848-17.664-17.152-17.664H201.152c-10.304 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.848 17.728 17.152 17.728z</PathGeometry>
<PathGeometry x:Key="pathDate2">M904 84.48h-137.152V49.088c0-17.664-13.696-35.392-34.304-35.392-20.544 0-34.304 14.144-34.304 35.392v35.392H286.848V49.088c0-17.664-13.696-35.392-34.304-35.392-20.544 0-34.304 14.144-34.304 35.392v35.392H81.152c-37.76 0-68.608 31.872-68.608 70.784v778.624c0 38.976 30.848 70.784 68.608 70.784h822.848c37.76 0 68.544-31.808 68.544-70.784V155.264c0-38.912-30.848-70.784-68.544-70.784z m0 814.08c0 21.184-13.76 35.328-34.304 35.328H115.392c-20.544 0-34.24-14.144-34.24-35.392V349.952h822.848v548.544z m0-619.392H81.152V190.656c0-21.184 13.696-35.392 34.24-35.392H218.24v35.392c0 17.728 13.76 35.392 34.304 35.392 20.608 0 34.304-14.08 34.304-35.392v-35.392h411.392v35.392c0 17.728 13.76 35.392 34.304 35.392 20.608 0 34.304-14.08 34.304-35.392v-35.392h102.848c20.544 0 34.304 14.208 34.304 35.392v88.512z</PathGeometry>
<PathGeometry x:Key="pathDate3">M201.152 526.912h68.544c10.24 0 17.152-7.04 17.152-17.728V438.4c0-10.624-6.848-17.664-17.152-17.664H201.152c-10.304 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.848 17.728 17.152 17.728z m171.392 176.96h68.608c10.24 0 17.088-7.04 17.088-17.728V615.36c0-10.624-6.848-17.664-17.088-17.664H372.48c-10.24 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.848 17.728 17.152 17.728z m0 176.96h68.608c10.24 0 17.088-7.04 17.088-17.728V792.32c0-10.624-6.848-17.664-17.088-17.664H372.48c-10.24 0-17.152 7.04-17.152 17.664v70.784c0 10.624 6.848 17.728 17.152 17.728z</PathGeometry>
......@@ -12,6 +12,7 @@
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="VerticalContentAlignment" Value="Stretch" />
<Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
<Setter Property="assist:DatePickerAssist.AutoClose" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DatePicker}">
......@@ -41,7 +42,7 @@
</ControlTemplate>
</DockPanel.Resources>
<Button x:Name="PART_Button" DockPanel.Dock="Right" Grid.Column="1" Foreground="{TemplateBinding BorderBrush}" HorizontalAlignment="Left" Margin="3,0,3,0" Grid.Row="0" Template="{StaticResource DropDownButtonTemplate}" VerticalAlignment="Center" Width="30" MinWidth="30" Height="30"/>
<TextBox x:Name="PART_TextBox" Width="{TemplateBinding Width}" Grid.Column="0" Text="{Binding SelectedDate,StringFormat='yyyy-MM-dd',RelativeSource={RelativeSource Mode=TemplatedParent}}" BorderThickness="0" Grid.Row="0" VerticalContentAlignment="Center" Style="{x:Null}"/>
<TextBox x:Name="PART_TextBox" Width="{TemplateBinding Width}" Grid.Column="0" Text="{Binding SelectedDate,StringFormat='yyyy-MM-dd',UpdateSourceTrigger=PropertyChanged,RelativeSource={RelativeSource Mode=TemplatedParent}}" BorderThickness="0" VerticalContentAlignment="Center" Padding="5 0" Grid.Row="0" Style="{x:Null}"/>
<Grid x:Name="PART_DisabledVisual" Grid.ColumnSpan="2" Grid.Column="0" IsHitTestVisible="False" Opacity="0" Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
......@@ -49,12 +50,12 @@
</Grid.ColumnDefinitions>
<Rectangle Grid.Column="0" Fill="#A5FFFFFF" RadiusY="1" Grid.Row="0" RadiusX="1"/>
<Rectangle Grid.Column="1" Fill="#A5FFFFFF" Height="18" Margin="3,0,3,0" RadiusY="1" Grid.Row="0" RadiusX="1" Width="19"/>
<Popup IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" VerticalOffset="3" Placement="Bottom" PlacementTarget="{Binding ElementName=PART_TextBox}" StaysOpen="False">
<Popup IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" VerticalOffset="5" Placement="Bottom" PlacementTarget="{Binding ElementName=PART_TextBox}" StaysOpen="False">
<Border Margin="8" Background="White">
<Border.Effect>
<DropShadowEffect Color="LightGray" Opacity="0.3" Direction="8"/>
</Border.Effect>
<Calendar Style="{DynamicResource CalendarDefaultStyle}" SelectedDate="{TemplateBinding SelectedDate }"/>
<Calendar Style="{DynamicResource CalendarDefaultStyle}" DisplayDateStart="{TemplateBinding DisplayDateStart}" DisplayDateEnd="{TemplateBinding DisplayDateEnd}" SelectedDate="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=SelectedDate,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Border>
</Popup>
</Grid>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册