| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741 |
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <Style x:Key="TextBolockTriggers" TargetType="Grid">
- <Style.Triggers>
- <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周六">
- <Setter Property="Background" Value="{DynamicResource MuchinfoBrush3}"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周日">
- <Setter Property="Background" Value="{DynamicResource MuchinfoBrush3}"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周一">
- <Setter Property="Background" Value="{DynamicResource MuchinfoBrush4}"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周二">
- <Setter Property="Background" Value="{DynamicResource MuchinfoBrush4}"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周三">
- <Setter Property="Background" Value="{DynamicResource MuchinfoBrush4}"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周四">
- <Setter Property="Background" Value="{DynamicResource MuchinfoBrush4}"/>
- </DataTrigger>
- <DataTrigger Binding="{Binding ElementName=txtBlock, Path=Text}" Value="周五">
- <Setter Property="Background" Value="{DynamicResource MuchinfoBrush4}"/>
- </DataTrigger>
- </Style.Triggers>
- </Style>
- <!--日历主体样式表-->
- <Style x:Key="CalendarItemStyle"
- TargetType="{x:Type CalendarItem}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type CalendarItem}">
- <ControlTemplate.Resources>
- <DataTemplate x:Key="{x:Static CalendarItem.DayTitleTemplateResourceKey}">
- <!--日历星期几的绑定样式,我格式化成周一,周二等-->
- <Grid Height="30"
- Width="50"
- Style="{StaticResource TextBolockTriggers}"
- Margin="1"
- HorizontalAlignment="Center"
- VerticalAlignment="Center">
- <TextBlock x:Name="txtBlock"
- FontSize="13"
- Foreground="white"
- FontFamily="微软雅黑"
- HorizontalAlignment="Center"
- Text="{Binding StringFormat=周{0}}"
- VerticalAlignment="Center" />
- </Grid>
- </DataTemplate>
- </ControlTemplate.Resources>
- <Grid x:Name="PART_Root">
- <Grid.Resources>
- <!--设置日历控件 IsEnable=false 时的不可用遮罩层颜色,并且会播放过渡动画-->
- <SolidColorBrush x:Key="DisabledColor"
- Color="#A5FFFFFF" />
- </Grid.Resources>
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates">
- <VisualState x:Name="Normal" />
- <VisualState x:Name="Disabled">
- <!--设置日历控件 IsEnable=false 时遮罩层透明度0-1变色动画-->
- <Storyboard>
- <DoubleAnimation Duration="0"
- To="1"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="PART_DisabledVisual" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <Border BorderBrush="#cfcfcf"
- BorderThickness="0"
- Background="{TemplateBinding Background}"
- CornerRadius="2">
- <Border>
- <Grid>
- <Grid.Resources>
- <!--日历头左箭头按钮样式模版-->
- <ControlTemplate x:Key="PreviousButtonTemplate"
- TargetType="{x:Type Button}">
- <!--鼠标悬停在左箭头按钮上时改变鼠标指针样式-->
- <Grid Cursor="Hand">
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates">
- <VisualState x:Name="Normal" />
- <VisualState x:Name="MouseOver">
- <!--鼠标悬停在左箭头按钮上时左箭头颜色变化动画-->
- <Storyboard>
- <ColorAnimation Duration="0"
- To="#ffffffff"
- Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
- Storyboard.TargetName="path" />
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Disabled">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To=".5"
- Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)"
- Storyboard.TargetName="path" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <!--左箭头整个区域矩形块-->
- <Rectangle Fill="{DynamicResource MuchinfoBrush3}"
- Opacity="1"
- Stretch="Fill" />
- <Grid>
- <!--左箭头-->
- <Path x:Name="path"
- Data="M288.75,232.25 L288.75,240.625 L283,236.625 z"
- Fill="#e0e0e0"
- HorizontalAlignment="Left"
- Height="15"
- Width="15"
- Margin="20,0,0,0"
- Stretch="Fill"
- VerticalAlignment="Center" />
- </Grid>
- </Grid>
- </ControlTemplate>
- <!--日历头右箭头按钮样式模版,这块跟左箭头样式模版没什么区别-->
- <ControlTemplate x:Key="NextButtonTemplate"
- TargetType="{x:Type Button}">
- <Grid Cursor="Hand">
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates">
- <VisualState x:Name="Normal" />
- <VisualState x:Name="MouseOver">
- <Storyboard>
- <ColorAnimation Duration="0"
- To="#ffffffff"
- Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)"
- Storyboard.TargetName="path" />
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Disabled">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To=".5"
- Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)"
- Storyboard.TargetName="path" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <Rectangle Fill="{DynamicResource MuchinfoBrush3}"
- Opacity="1"
- Stretch="Fill" />
- <Grid>
- <Path x:Name="path"
- Data="M282.875,231.875 L282.875,240.375 L288.625,236 z"
- Fill="#e0e0e0"
- HorizontalAlignment="Right"
- Height="15"
- Width="15"
- Margin="0,0,20,0"
- Stretch="Fill"
- VerticalAlignment="Center" />
- </Grid>
- </Grid>
- </ControlTemplate>
- <!--日历头中间年按钮样式模版-->
- <ControlTemplate x:Key="HeaderButtonTemplate"
- TargetType="{x:Type Button}">
- <Grid Cursor="Hand">
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates">
- <VisualState x:Name="Normal" />
- <VisualState x:Name="MouseOver">
- <Storyboard>
- <ColorAnimation Duration="0"
- To="#ffffffff"
- Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
- Storyboard.TargetName="buttonContent" />
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Disabled">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To=".5"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="buttonContent" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <ContentPresenter x:Name="buttonContent"
- ContentTemplate="{TemplateBinding ContentTemplate}"
- Content="{TemplateBinding Content}"
- TextElement.Foreground="#e0e0e0"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- Margin="1,4,1,9"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
- </Grid>
- </ControlTemplate>
- </Grid.Resources>
- <Grid.RowDefinitions>
- <!--日历头,左箭头,年,右箭头-->
- <RowDefinition Height="Auto" />
- <!--日历内容,星期几和具体的日期几号几号-->
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- <Grid.ColumnDefinitions>
- <!--左箭头-->
- <ColumnDefinition Width="Auto" />
- <!--年-->
- <ColumnDefinition Width="*" />
- <!--右箭头-->
- <ColumnDefinition Width="Auto" />
- </Grid.ColumnDefinitions>
- <!--头,左箭头,年,右箭头,整体的背景色-->
- <Border Grid.Row="0"
- Grid.ColumnSpan="3"
- Background="{DynamicResource MuchinfoBrush3}"></Border>
- <!--左箭头-->
- <Button x:Name="PART_PreviousButton"
- Grid.Column="0"
- Focusable="False"
- HorizontalAlignment="Left"
- Grid.Row="0"
- Template="{StaticResource PreviousButtonTemplate}" />
- <!--年-->
- <Button x:Name="PART_HeaderButton"
- Grid.Column="1"
- FontFamily="微软雅黑"
- Focusable="False"
- FontSize="17"
- HorizontalAlignment="Center"
- Grid.Row="0"
- Template="{StaticResource HeaderButtonTemplate}"
- VerticalAlignment="Center" />
- <!--右箭头-->
- <Button x:Name="PART_NextButton"
- Grid.Column="2"
- Focusable="False"
- HorizontalAlignment="Right"
- Grid.Row="0"
- Template="{StaticResource NextButtonTemplate}" />
- <!--日期几号几号内容显示-->
- <Border Grid.Row="1"
- Grid.ColumnSpan="3"
- Margin="0"
- BorderBrush="#cfcfcf"
- BorderThickness="3,0,3,3">
- <Grid x:Name="PART_MonthView"
- HorizontalAlignment="Center"
- Visibility="Visible">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="auto" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- </Grid>
- </Border>
- <!--月和年内容显示-->
- <Grid x:Name="PART_YearView"
- Grid.ColumnSpan="3"
- HorizontalAlignment="Center"
- Margin="6,-3,7,6"
- Grid.Row="1"
- Visibility="Hidden"
- VerticalAlignment="Center">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Grid.RowDefinitions>
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- <RowDefinition Height="*" />
- </Grid.RowDefinitions>
- </Grid>
- </Grid>
- </Border>
- </Border>
- <!--日历不可用的遮罩层-->
- <Rectangle x:Name="PART_DisabledVisual"
- Fill="{StaticResource DisabledColor}"
- Opacity="0"
- RadiusY="2"
- RadiusX="2"
- Stretch="Fill"
- Stroke="{StaticResource DisabledColor}"
- StrokeThickness="1"
- Visibility="Collapsed" />
- </Grid>
- <!--触发器属性-->
- <ControlTemplate.Triggers>
- <Trigger Property="IsEnabled"
- Value="False">
- <Setter Property="Visibility"
- TargetName="PART_DisabledVisual"
- Value="Visible" />
- </Trigger>
- <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}"
- Value="Year">
- <Setter Property="Visibility"
- TargetName="PART_MonthView"
- Value="Hidden" />
- <Setter Property="Visibility"
- TargetName="PART_YearView"
- Value="Visible" />
- </DataTrigger>
- <DataTrigger Binding="{Binding DisplayMode, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Calendar}}}"
- Value="Decade">
- <Setter Property="Visibility"
- TargetName="PART_MonthView"
- Value="Hidden" />
- <Setter Property="Visibility"
- TargetName="PART_YearView"
- Value="Visible" />
- </DataTrigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--单个几号几号按钮的样式模版-->
- <Style x:Key="CalendarDayButtonStyle"
- TargetType="{x:Type CalendarDayButton}">
- <Setter Property="Margin"
- Value="1" />
- <Setter Property="MinWidth"
- Value="5" />
- <Setter Property="MinHeight"
- Value="5" />
- <Setter Property="FontSize"
- Value="15" />
- <Setter Property="FontFamily"
- Value="微软雅黑" />
- <Setter Property="HorizontalContentAlignment"
- Value="Center" />
- <Setter Property="VerticalContentAlignment"
- Value="Center" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type CalendarDayButton}">
- <Grid>
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates">
- <VisualStateGroup.Transitions>
- <VisualTransition GeneratedDuration="0:0:0.1" />
- </VisualStateGroup.Transitions>
- <VisualState x:Name="Normal" />
- <!--悬停的颜色动画-->
- <VisualState x:Name="MouseOver">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To="0.5"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="HighlightBackground" />
- </Storyboard>
- </VisualState>
- <!--按下后动画-->
- <VisualState x:Name="Pressed">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To="0.5"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="HighlightBackground" />
- </Storyboard>
- </VisualState>
- <!--不可用动画-->
- <VisualState x:Name="Disabled">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To="0"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="HighlightBackground" />
- <DoubleAnimation Duration="0"
- To=".35"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="NormalText" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- <VisualStateGroup x:Name="SelectionStates">
- <VisualStateGroup.Transitions>
- <VisualTransition GeneratedDuration="0" />
- </VisualStateGroup.Transitions>
- <VisualState x:Name="Unselected" />
- <!--选中某日期的样式-->
- <VisualState x:Name="Selected">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To=".75"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="SelectedBackground" />
- <ColorAnimation Duration="0"
- To="white"
- Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
- Storyboard.TargetName="NormalText" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- <VisualStateGroup x:Name="CalendarButtonFocusStates">
- <VisualStateGroup.Transitions>
- <VisualTransition GeneratedDuration="0" />
- </VisualStateGroup.Transitions>
- <VisualState x:Name="CalendarButtonFocused">
- <Storyboard>
- <ObjectAnimationUsingKeyFrames Duration="0"
- Storyboard.TargetProperty="Visibility"
- Storyboard.TargetName="DayButtonFocusVisual">
- <DiscreteObjectKeyFrame KeyTime="0">
- <DiscreteObjectKeyFrame.Value>
- <Visibility>Visible</Visibility>
- </DiscreteObjectKeyFrame.Value>
- </DiscreteObjectKeyFrame>
- </ObjectAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- <VisualState x:Name="CalendarButtonUnfocused">
- <Storyboard>
- <ObjectAnimationUsingKeyFrames Duration="0"
- Storyboard.TargetProperty="Visibility"
- Storyboard.TargetName="DayButtonFocusVisual">
- <DiscreteObjectKeyFrame KeyTime="0">
- <DiscreteObjectKeyFrame.Value>
- <Visibility>Collapsed</Visibility>
- </DiscreteObjectKeyFrame.Value>
- </DiscreteObjectKeyFrame>
- </ObjectAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- <VisualStateGroup x:Name="ActiveStates">
- <VisualStateGroup.Transitions>
- <VisualTransition GeneratedDuration="0" />
- </VisualStateGroup.Transitions>
- <VisualState x:Name="Active" />
- <VisualState x:Name="Inactive">
- <Storyboard>
- <ColorAnimation Duration="0"
- To="#b4b3b3"
- Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
- Storyboard.TargetName="NormalText" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- <VisualStateGroup x:Name="DayStates">
- <VisualStateGroup.Transitions>
- <VisualTransition GeneratedDuration="0" />
- </VisualStateGroup.Transitions>
- <VisualState x:Name="RegularDay" />
- <!--今天的样式-->
- <VisualState x:Name="Today">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To="1"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="TodayBackground" />
- <ColorAnimation Duration="0"
- To="#666666"
- Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
- Storyboard.TargetName="NormalText" />
- <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
- Storyboard.TargetName="imgToday">
- <DiscreteObjectKeyFrame KeyTime="0">
- <DiscreteObjectKeyFrame.Value>
- <Visibility>Visible</Visibility>
- </DiscreteObjectKeyFrame.Value>
- </DiscreteObjectKeyFrame>
- </ObjectAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- <!--过期日期的-->
- <VisualStateGroup x:Name="BlackoutDayStates">
- <VisualStateGroup.Transitions>
- <VisualTransition GeneratedDuration="0" />
- </VisualStateGroup.Transitions>
- <VisualState x:Name="NormalDay" />
- <VisualState x:Name="BlackoutDay">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To=".2"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="Blackout" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <Border BorderBrush="#bbbbbb"
- BorderThickness="1">
- <Border BorderBrush="white"
- BorderThickness="2,2,0,0"
- Margin="1,1,0,0"></Border>
- </Border>
- <Rectangle x:Name="TodayBackground"
- Fill="#c6c6c6"
- Opacity="0"
- RadiusY="1"
- RadiusX="1" />
- <Rectangle x:Name="SelectedBackground"
- Fill="{DynamicResource MuchinfoBrush3}"
- Opacity="0"
- RadiusY="1"
- RadiusX="1" />
- <Border BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- Background="{TemplateBinding Background}" />
- <Rectangle x:Name="HighlightBackground"
- Fill="{DynamicResource MuchinfoBrush57}"
- Opacity="0"
- RadiusY="1"
- RadiusX="1" />
- <ContentPresenter x:Name="NormalText"
- TextElement.Foreground="#666666"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
- <Path x:Name="Blackout"
- Data="M8.1772461,11.029181 L10.433105,11.029181 L11.700684,12.801641 L12.973633,11.029181 L15.191895,11.029181 L12.844727,13.999395 L15.21875,17.060919 L12.962891,17.060919 L11.673828,15.256231 L10.352539,17.060919 L8.1396484,17.060919 L10.519043,14.042364 z"
- Fill="#FF000000"
- HorizontalAlignment="Stretch"
- Margin="3"
- Opacity="0"
- RenderTransformOrigin="0.5,0.5"
- Stretch="Fill"
- VerticalAlignment="Stretch" />
- <Rectangle x:Name="DayButtonFocusVisual"
- IsHitTestVisible="false"
- RadiusY="1"
- RadiusX="1"
- Stroke="{DynamicResource MuchinfoBrush3}"
- Visibility="Collapsed" />
- <Image x:Name="imgToday"
- Width="32"
- Height="22"
- Source="/Muchinfo.MTPClient;component/Images/today.png"
- VerticalAlignment="Top"
- HorizontalAlignment="Left"
- Visibility="Hidden" />
- </Grid>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="CalendarButtonStyle"
- TargetType="{x:Type CalendarButton}">
- <Setter Property="Background"
- Value="{DynamicResource MuchinfoBrush57}" />
- <Setter Property="MinWidth"
- Value="50" />
- <Setter Property="MinHeight"
- Value="50" />
- <Setter Property="Margin"
- Value="2" />
- <Setter Property="FontSize"
- Value="15" />
- <Setter Property="HorizontalContentAlignment"
- Value="Center" />
- <Setter Property="VerticalContentAlignment"
- Value="Center" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type CalendarButton}">
- <Grid>
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CommonStates">
- <VisualStateGroup.Transitions>
- <VisualTransition GeneratedDuration="0:0:0.1" />
- </VisualStateGroup.Transitions>
- <VisualState x:Name="Normal" />
- <VisualState x:Name="MouseOver">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To=".5"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="Background" />
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Pressed">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To=".5"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="Background" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- <VisualStateGroup x:Name="SelectionStates">
- <VisualStateGroup.Transitions>
- <VisualTransition GeneratedDuration="0" />
- </VisualStateGroup.Transitions>
- <VisualState x:Name="Unselected" />
- <VisualState x:Name="Selected">
- <Storyboard>
- <DoubleAnimation Duration="0"
- To=".75"
- Storyboard.TargetProperty="Opacity"
- Storyboard.TargetName="SelectedBackground" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- <VisualStateGroup x:Name="ActiveStates">
- <VisualStateGroup.Transitions>
- <VisualTransition GeneratedDuration="0" />
- </VisualStateGroup.Transitions>
- <VisualState x:Name="Active" />
- <VisualState x:Name="Inactive">
- <Storyboard>
- <ColorAnimation Duration="0"
- To="#FF777777"
- Storyboard.TargetProperty="(TextElement.Foreground).(SolidColorBrush.Color)"
- Storyboard.TargetName="NormalText" />
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- <VisualStateGroup x:Name="CalendarButtonFocusStates">
- <VisualStateGroup.Transitions>
- <VisualTransition GeneratedDuration="0" />
- </VisualStateGroup.Transitions>
- <VisualState x:Name="CalendarButtonFocused">
- <Storyboard>
- <ObjectAnimationUsingKeyFrames Duration="0"
- Storyboard.TargetProperty="Visibility"
- Storyboard.TargetName="CalendarButtonFocusVisual">
- <DiscreteObjectKeyFrame KeyTime="0">
- <DiscreteObjectKeyFrame.Value>
- <Visibility>Visible</Visibility>
- </DiscreteObjectKeyFrame.Value>
- </DiscreteObjectKeyFrame>
- </ObjectAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- <VisualState x:Name="CalendarButtonUnfocused">
- <Storyboard>
- <ObjectAnimationUsingKeyFrames Duration="0"
- Storyboard.TargetProperty="Visibility"
- Storyboard.TargetName="CalendarButtonFocusVisual">
- <DiscreteObjectKeyFrame KeyTime="0">
- <DiscreteObjectKeyFrame.Value>
- <Visibility>Collapsed</Visibility>
- </DiscreteObjectKeyFrame.Value>
- </DiscreteObjectKeyFrame>
- </ObjectAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- <Rectangle x:Name="SelectedBackground"
- Fill="{TemplateBinding Background}"
- Opacity="0"
- RadiusY="1"
- RadiusX="1" />
- <Rectangle x:Name="Background"
- Fill="{TemplateBinding Background}"
- Opacity="0"
- RadiusY="1"
- RadiusX="1" />
- <ContentPresenter x:Name="NormalText"
- TextElement.Foreground="#FF333333"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- Margin="1,0,1,1"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
- <Rectangle x:Name="CalendarButtonFocusVisual"
- IsHitTestVisible="false"
- RadiusY="1"
- RadiusX="1"
- Stroke="{DynamicResource MuchinfoBrush3}"
- Visibility="Collapsed" />
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="IsFocused"
- Value="True">
- <Setter Property="Visibility"
- TargetName="CalendarButtonFocusVisual"
- Value="Visible" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="CalendarStyle"
- TargetType="{x:Type Calendar}">
- <!--日历控件的背景色,也可以改成绑定的-->
- <Setter Property="Background"
- Value="#f6f6f6" />
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Calendar}">
- <StackPanel x:Name="PART_Root"
- HorizontalAlignment="Center"
- VerticalAlignment="Center">
- <!--这个是日历控件的主体元件,也是内部元件PART_CalendarItem名称不要更改,可以改它的其它样式属性-->
- <CalendarItem x:Name="PART_CalendarItem"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- Background="{TemplateBinding Background}"
- Style="{TemplateBinding CalendarItemStyle}"
- Height="240"
- Width="240"
- HorizontalAlignment="Stretch"
- VerticalAlignment="Stretch" />
- </StackPanel>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Setter Property="CalendarItemStyle" Value="{StaticResource CalendarItemStyle}"/>
- <Setter Property="CalendarDayButtonStyle" Value="{StaticResource CalendarDayButtonStyle}"/>
- <Setter Property="CalendarButtonStyle" Value="{StaticResource CalendarButtonStyle}"/>
- </Style>
- </ResourceDictionary>
|