| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:r="clr-namespace:SKMC.UI.ValidationRules">
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="pack://application:,,,/SKMC.UI;component/Styles/Calendar.xaml"/>
- <!--<ResourceDictionary Source="pack://application:,,,/SKMC.UI;component/Assets/Brushes.xaml"/>-->
- <ResourceDictionary Source="pack://application:,,,/SKMC.UI;component/Converters/Converters.xaml"/>
- <ResourceDictionary Source="pack://application:,,,/SKMC.UI;component/Assets/Icons.xaml"/>
- </ResourceDictionary.MergedDictionaries>
-
- <!--日期选择-->
- <Style x:Key="DatePicker.Primary" TargetType="{x:Type DatePicker}">
- <Setter Property="Height" Value="30"/>
- <Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
- <Setter Property="Background" Value="#00FFFFFF" />
- <Setter Property="HorizontalContentAlignment" Value="Center"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="IsDropDownOpen" Value="False"/>
- <Setter Property="FontSize" Value="{DynamicResource FontSize.Body}"/>
- <Setter Property="BorderThickness" Value="1" />
- <Setter Property="DatePicker.IsTodayHighlighted" Value="True" />
- <Setter Property="Padding" Value="2" />
- <Setter Property="DatePicker.SelectedDateFormat" Value="Short" />
- <Setter Property="BorderBrush">
- <Setter.Value>
- <LinearGradientBrush StartPoint=".5,1" EndPoint=".5,0">
- <GradientStop Offset="0" Color="#FFA3AEB9" />
- <GradientStop Offset="0.375" Color="#FF8399A9" />
- <GradientStop Offset="0.375" Color="#FF718597" />
- <GradientStop Offset="1" Color="#FF617584" />
- </LinearGradientBrush>
- </Setter.Value>
- </Setter>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type DatePicker}">
- <Border Name="PART_Root"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- Background="{TemplateBinding Background}"
- SnapsToDevicePixels="True">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <TextBox x:Name="PART_TextBox" Grid.Column="0"
- HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Center"
- Focusable="{TemplateBinding UIElement.Focusable}"
- Validation.ErrorTemplate="{x:Null}"
- MinWidth="100"
- Background="Transparent"
- BorderThickness="0"
- Foreground="{TemplateBinding Foreground}"
- FontSize="{TemplateBinding FontSize}"
- IsReadOnly="True">
- <TextBox.Text>
- <Binding Path="SelectedDate" Converter="{StaticResource DateTimeToStringConverter}" RelativeSource="{RelativeSource AncestorType={x:Type DatePicker}}">
- <Binding.ValidationRules>
- <r:DateTimeRule/>
- </Binding.ValidationRules>
- </Binding>
- </TextBox.Text>
- </TextBox>
- <Grid Name="PART_DisabledVisual" Column="0" ColumnSpan="2" IsHitTestVisible="False" Opacity="0">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <Popup Name="PART_Popup" AllowsTransparency="True" Placement="Bottom" StaysOpen="False" PlacementTarget="{Binding ElementName=PART_TextBox}" />
- </Grid>
- <Button x:Name="PART_Button"
- Grid.Row="0"
- Grid.Column="1"
- Margin="5">
- <Button.Style>
- <Style TargetType="{x:Type Button}">
- <Setter Property="Height" Value="25"/>
- <Setter Property="Width" Value="25"/>
- <Setter Property="HorizontalAlignment" Value="Center"/>
- <Setter Property="VerticalAlignment" Value="Center"/>
- <Setter Property="Focusable" Value="False"/>
- <Setter Property="Foreground" Value="{DynamicResource Brush.Text}"/>
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="HorizontalContentAlignment" Value="Center"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="Cursor" Value="Hand"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
- VerticalAlignment="{TemplateBinding VerticalAlignment}">
- <Path x:Name="icon" Width="20" Height="20"
- Data="{StaticResource Icon.Calendar}"
- Stretch="Uniform"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="False">
- <Setter TargetName="icon" Property="Fill" Value="{DynamicResource Brush.Icon}"/>
- </Trigger>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="icon" Property="Fill" Value="{DynamicResource Brush.IconInactive}"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Background" Value="{DynamicResource Brush.SecondaryButtonDisabled}"/>
- </Trigger>
- <Trigger Property="IsPressed" Value="True">
- <Setter Property="Background" Value="{DynamicResource Brush.SecondaryButtonPressed}"/>
- </Trigger>
- </Style.Triggers>
- </Style>
- </Button.Style>
- </Button>
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates">
- <VisualState x:Name="Normal" />
- <VisualState x:Name="Disabled">
- <Storyboard>
- <DoubleAnimation Storyboard.TargetName="PART_DisabledVisual" Storyboard.TargetProperty="Opacity" To="1" Duration="0" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <DataTrigger Value="false" Binding="{Binding Source={x:Static SystemParameters.HighContrast}}">
- <Setter TargetName="PART_TextBox" Property="Foreground" Value="{Binding Foreground, RelativeSource={RelativeSource TemplatedParent}}" />
- </DataTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <!-- 日历样式 -->
- <Setter Property="DatePicker.CalendarStyle" Value="{StaticResource Calendar.Primary}"/>
- </Style>
- </ResourceDictionary>
|