|
| 1 | +<ResourceDictionary xmlns="https://github.com/avaloniaui" |
| 2 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | + xmlns:hc="https://handyorg.github.io/handycontrol"> |
| 4 | + <ControlTheme x:Key="{x:Type CalendarButton}" |
| 5 | + TargetType="CalendarButton"> |
| 6 | + <Setter Property="MinWidth" |
| 7 | + Value="10" /> |
| 8 | + <Setter Property="MinHeight" |
| 9 | + Value="10" /> |
| 10 | + <Setter Property="FontSize" |
| 11 | + Value="12" /> |
| 12 | + <Setter Property="Width" |
| 13 | + Value="40" /> |
| 14 | + <Setter Property="Height" |
| 15 | + Value="32" /> |
| 16 | + <Setter Property="HorizontalContentAlignment" |
| 17 | + Value="Center" /> |
| 18 | + <Setter Property="VerticalContentAlignment" |
| 19 | + Value="Center" /> |
| 20 | + <Setter Property="Template"> |
| 21 | + <ControlTemplate> |
| 22 | + <Panel> |
| 23 | + <Rectangle x:Name="SelectedBackground" |
| 24 | + Fill="{DynamicResource DangerBrush}" |
| 25 | + Opacity="0" |
| 26 | + RadiusY="16" |
| 27 | + RadiusX="16" /> |
| 28 | + <ContentPresenter Name="PART_ContentPresenter" |
| 29 | + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 30 | + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
| 31 | + Content="{TemplateBinding Content}" |
| 32 | + ContentTemplate="{TemplateBinding ContentTemplate}" |
| 33 | + FontSize="{TemplateBinding FontSize}" |
| 34 | + Foreground="{TemplateBinding Foreground}" /> |
| 35 | + </Panel> |
| 36 | + </ControlTemplate> |
| 37 | + </Setter> |
| 38 | + |
| 39 | + <Style Selector="^:selected"> |
| 40 | + <Style Selector="^ /template/ Rectangle#SelectedBackground"> |
| 41 | + <Setter Property="Opacity" |
| 42 | + Value="1" /> |
| 43 | + </Style> |
| 44 | + <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
| 45 | + <Setter Property="Foreground" |
| 46 | + Value="{DynamicResource TextIconBrush}" /> |
| 47 | + </Style> |
| 48 | + </Style> |
| 49 | + </ControlTheme> |
| 50 | + |
| 51 | + <ControlTheme x:Key="{x:Type CalendarDayButton}" |
| 52 | + TargetType="CalendarDayButton"> |
| 53 | + <Setter Property="Foreground" |
| 54 | + Value="{DynamicResource PrimaryTextBrush}" /> |
| 55 | + <Setter Property="FontSize" |
| 56 | + Value="{StaticResource TextFontSize}" /> |
| 57 | + <Setter Property="MinWidth" |
| 58 | + Value="10" /> |
| 59 | + <Setter Property="MinHeight" |
| 60 | + Value="10" /> |
| 61 | + <Setter Property="Width" |
| 62 | + Value="32" /> |
| 63 | + <Setter Property="Height" |
| 64 | + Value="32" /> |
| 65 | + <Setter Property="HorizontalContentAlignment" |
| 66 | + Value="Center" /> |
| 67 | + <Setter Property="VerticalContentAlignment" |
| 68 | + Value="Center" /> |
| 69 | + <Setter Property="Template"> |
| 70 | + <Setter.Value> |
| 71 | + <ControlTemplate> |
| 72 | + <Panel> |
| 73 | + <Rectangle x:Name="TodayBackground" |
| 74 | + Fill="{DynamicResource DangerBrush}" |
| 75 | + RadiusX="16" |
| 76 | + RadiusY="16" |
| 77 | + IsVisible="False" /> |
| 78 | + <Rectangle x:Name="SelectedBackground" |
| 79 | + Fill="{DynamicResource PrimaryBrush}" |
| 80 | + RadiusY="16" |
| 81 | + RadiusX="16" |
| 82 | + Opacity="0" /> |
| 83 | + <ContentPresenter Name="PART_ContentPresenter" |
| 84 | + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 85 | + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
| 86 | + Content="{TemplateBinding Content}" |
| 87 | + ContentTemplate="{TemplateBinding ContentTemplate}" |
| 88 | + FontSize="{TemplateBinding FontSize}" |
| 89 | + Foreground="{TemplateBinding Foreground}" /> |
| 90 | + </Panel> |
| 91 | + </ControlTemplate> |
| 92 | + </Setter.Value> |
| 93 | + </Setter> |
| 94 | + |
| 95 | + <Style Selector="^:today"> |
| 96 | + <Style Selector="^ /template/ Rectangle#TodayBackground"> |
| 97 | + <Setter Property="IsVisible" |
| 98 | + Value="True" /> |
| 99 | + </Style> |
| 100 | + <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
| 101 | + <Setter Property="Foreground" |
| 102 | + Value="{DynamicResource TextIconBrush}" /> |
| 103 | + </Style> |
| 104 | + </Style> |
| 105 | + |
| 106 | + <Style Selector="^:selected"> |
| 107 | + <Style Selector="^ /template/ Rectangle#SelectedBackground"> |
| 108 | + <Setter Property="Opacity" |
| 109 | + Value="1" /> |
| 110 | + </Style> |
| 111 | + <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
| 112 | + <Setter Property="Foreground" |
| 113 | + Value="{DynamicResource TextIconBrush}" /> |
| 114 | + </Style> |
| 115 | + </Style> |
| 116 | + |
| 117 | + <Style Selector="^:inactive"> |
| 118 | + <Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
| 119 | + <Setter Property="Foreground" |
| 120 | + Value="{DynamicResource ThirdlyTextBrush}" /> |
| 121 | + </Style> |
| 122 | + </Style> |
| 123 | + </ControlTheme> |
| 124 | + |
| 125 | + <ControlTheme x:Key="{x:Type CalendarItem}" |
| 126 | + TargetType="CalendarItem"> |
| 127 | + <Setter Property="Margin" |
| 128 | + Value="0" /> |
| 129 | + <Setter Property="Template"> |
| 130 | + <ControlTemplate> |
| 131 | + <Grid RowDefinitions="Auto,*" |
| 132 | + ColumnDefinitions="Auto,*,Auto"> |
| 133 | + <Border Margin="4" |
| 134 | + CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" |
| 135 | + Background="{TemplateBinding HeaderBackground}" |
| 136 | + Grid.ColumnSpan="3" /> |
| 137 | + <Button x:Name="PART_PreviousButton" |
| 138 | + Width="50" |
| 139 | + Foreground="{Binding Path=(hc:TitleElement.Foreground),RelativeSource={RelativeSource TemplatedParent}}" |
| 140 | + HorizontalAlignment="Left" |
| 141 | + Grid.Column="0" |
| 142 | + Height="50" |
| 143 | + Padding="16" |
| 144 | + Focusable="False" |
| 145 | + Grid.Row="0" |
| 146 | + Theme="{StaticResource ButtonIcon}" |
| 147 | + hc:IconElement.Geometry="{StaticResource LeftGeometry}" /> |
| 148 | + <Button x:Name="PART_HeaderButton" |
| 149 | + Focusable="False" |
| 150 | + Foreground="{Binding Path=(hc:TitleElement.Foreground),RelativeSource={RelativeSource TemplatedParent}}" |
| 151 | + Grid.Column="1" |
| 152 | + FontSize="20" |
| 153 | + HorizontalAlignment="Center" |
| 154 | + Grid.Row="0" |
| 155 | + Theme="{StaticResource ButtonCustom}" /> |
| 156 | + <Button x:Name="PART_NextButton" |
| 157 | + Width="50" |
| 158 | + Foreground="{Binding Path=(hc:TitleElement.Foreground),RelativeSource={RelativeSource TemplatedParent}}" |
| 159 | + HorizontalAlignment="Right" |
| 160 | + Height="50" |
| 161 | + Padding="16" |
| 162 | + Grid.Column="2" |
| 163 | + Focusable="False" |
| 164 | + Grid.Row="0" |
| 165 | + Theme="{StaticResource ButtonIcon}" |
| 166 | + hc:IconElement.Geometry="{StaticResource RightGeometry}" /> |
| 167 | + <Grid Width="240" |
| 168 | + Height="240" |
| 169 | + x:Name="PART_MonthView" |
| 170 | + Margin="10,6,10,10" |
| 171 | + Grid.ColumnSpan="3" |
| 172 | + Grid.Column="0" |
| 173 | + HorizontalAlignment="Center" |
| 174 | + VerticalAlignment="Center" |
| 175 | + Grid.Row="1" |
| 176 | + IsVisible="True" |
| 177 | + ColumnDefinitions="*,*,*,*,*,*,*" |
| 178 | + RowDefinitions="*,*,*,*,*,*,*"> |
| 179 | + </Grid> |
| 180 | + <Grid Width="240" |
| 181 | + Height="240" |
| 182 | + x:Name="PART_YearView" |
| 183 | + Margin="10,6,10,10" |
| 184 | + Grid.ColumnSpan="3" |
| 185 | + Grid.Column="0" |
| 186 | + HorizontalAlignment="Center" |
| 187 | + VerticalAlignment="Center" |
| 188 | + Grid.Row="1" |
| 189 | + IsVisible="False" |
| 190 | + ColumnDefinitions="*,*,*,*" |
| 191 | + RowDefinitions="*,*,*"> |
| 192 | + </Grid> |
| 193 | + </Grid> |
| 194 | + </ControlTemplate> |
| 195 | + </Setter> |
| 196 | + <Setter Property="DayTitleTemplate"> |
| 197 | + <Template x:DataType="x:String"> |
| 198 | + <TextBlock Margin="0,6,0,6" |
| 199 | + Foreground="{DynamicResource PrimaryTextBrush}" |
| 200 | + HorizontalAlignment="Center" |
| 201 | + VerticalAlignment="Center" |
| 202 | + FontWeight="Bold" |
| 203 | + Text="{Binding}" /> |
| 204 | + </Template> |
| 205 | + </Setter> |
| 206 | + </ControlTheme> |
| 207 | + |
| 208 | + <ControlTheme x:Key="CalendarBaseStyle" |
| 209 | + TargetType="Calendar"> |
| 210 | + <Setter Property="Foreground" |
| 211 | + Value="{DynamicResource PrimaryTextBrush}" /> |
| 212 | + <Setter Property="Background" |
| 213 | + Value="{DynamicResource RegionBrush}" /> |
| 214 | + <Setter Property="BorderBrush" |
| 215 | + Value="{DynamicResource BorderBrush}" /> |
| 216 | + <Setter Property="BorderThickness" |
| 217 | + Value="0" /> |
| 218 | + <Setter Property="HeaderBackground" |
| 219 | + Value="{DynamicResource TitleBrush}" /> |
| 220 | + <Setter Property="hc:BorderElement.CornerRadius" |
| 221 | + Value="{StaticResource DefaultCornerRadius}" /> |
| 222 | + <Setter Property="hc:TitleElement.Foreground" |
| 223 | + Value="{DynamicResource TextIconBrush}" /> |
| 224 | + <Setter Property="Template"> |
| 225 | + <ControlTemplate> |
| 226 | + <Panel Margin="8,4,8,8"> |
| 227 | + <Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" |
| 228 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 229 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 230 | + Background="{TemplateBinding Background}" |
| 231 | + Effect="{StaticResource EffectShadow2}" /> |
| 232 | + <Panel Name="PART_Root" |
| 233 | + HorizontalAlignment="Center" |
| 234 | + VerticalAlignment="Center"> |
| 235 | + <CalendarItem Name="PART_CalendarItem" |
| 236 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 237 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 238 | + Background="{TemplateBinding Background}" |
| 239 | + HeaderBackground="{TemplateBinding HeaderBackground}" /> |
| 240 | + </Panel> |
| 241 | + </Panel> |
| 242 | + </ControlTemplate> |
| 243 | + </Setter> |
| 244 | + </ControlTheme> |
| 245 | + |
| 246 | + <ControlTheme x:Key="{x:Type Calendar}" |
| 247 | + TargetType="Calendar" |
| 248 | + BasedOn="{StaticResource CalendarBaseStyle}" /> |
| 249 | +</ResourceDictionary> |
0 commit comments