|
67 | 67 | <Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary}" /> |
68 | 68 | <Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary}" /> |
69 | 69 | <Setter Property="BorderThickness" Value="1" /> |
| 70 | + <Setter Property="Cursor" Value="Hand" /> |
70 | 71 | <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" /> |
71 | 72 | <Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground), FallbackValue=Black}" /> |
72 | 73 | <Setter Property="Template"> |
|
103 | 104 | <ColumnDefinition Width="Auto" /> |
104 | 105 | <ColumnDefinition Width="*" /> |
105 | 106 | </Grid.ColumnDefinitions> |
106 | | - <Viewbox Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:CheckBoxAssist.CheckBoxSize)}" |
| 107 | + <Viewbox x:Name="IconHost" |
| 108 | + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:CheckBoxAssist.CheckBoxSize)}" |
107 | 109 | Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:CheckBoxAssist.CheckBoxSize)}" |
108 | 110 | VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
109 | 111 | FlowDirection="LeftToRight"> |
110 | | - <Canvas Width="24" Height="24"> |
| 112 | + <Canvas Width="24" Height="24" Background="Transparent"> |
111 | 113 | <Path x:Name="Graphic" |
112 | 114 | Data="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z" |
113 | 115 | Fill="{DynamicResource MaterialDesign.Brush.ForegroundLight}" /> |
|
131 | 133 | </Ellipse> |
132 | 134 | </Canvas> |
133 | 135 | </Viewbox> |
| 136 | + |
| 137 | + <!-- halo shown when hovering --> |
| 138 | + <Ellipse x:Name="halo" |
| 139 | + Grid.Column="0" |
| 140 | + HorizontalAlignment="Center" |
| 141 | + VerticalAlignment="Center" |
| 142 | + Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:CheckBoxAssist.CheckBoxSize), Converter={x:Static converters:MathConverter.MultiplyInstance}, ConverterParameter=1.6}" |
| 143 | + Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:CheckBoxAssist.CheckBoxSize), Converter={x:Static converters:MathConverter.MultiplyInstance}, ConverterParameter=1.6}" |
| 144 | + Fill="{TemplateBinding Foreground}" |
| 145 | + Opacity="0" |
| 146 | + IsHitTestVisible="False" |
| 147 | + RenderTransformOrigin="0.5,0.5" /> |
| 148 | + |
134 | 149 | <ContentPresenter x:Name="contentPresenter" |
135 | 150 | Grid.Column="1" |
136 | 151 | Margin="{TemplateBinding Padding}" |
|
152 | 167 | </MultiDataTrigger> |
153 | 168 | <Trigger Property="HasContent" Value="true"> |
154 | 169 | <Setter Property="FocusVisualStyle" Value="{StaticResource OptionMarkFocusVisual}" /> |
155 | | - <Setter Property="Padding" Value="4,2,0,0" /> |
| 170 | + <Setter Property="Padding" Value="0,2,0,0" /> |
156 | 171 | </Trigger> |
157 | 172 | <Trigger Property="IsPressed" Value="true" /> |
158 | 173 | <Trigger Property="IsChecked" Value="true"> |
|
171 | 186 | <Setter TargetName="Graphic" Property="Fill" Value="{DynamicResource MaterialDesign.Brush.ValidationError}" /> |
172 | 187 | <Setter TargetName="contentPresenter" Property="Control.Foreground" Value="{DynamicResource MaterialDesign.Brush.ValidationError}" /> |
173 | 188 | </Trigger> |
| 189 | + <Trigger SourceName="IconHost" Property="IsMouseOver" Value="True"> |
| 190 | + <Setter TargetName="halo" Property="Opacity" Value="0.15" /> |
| 191 | + </Trigger> |
174 | 192 | </ControlTemplate.Triggers> |
175 | 193 | </ControlTemplate> |
176 | 194 | </Setter.Value> |
|
242 | 260 | Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(wpf:CheckBoxAssist.CheckBoxSize)}" |
243 | 261 | VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
244 | 262 | FlowDirection="LeftToRight"> |
245 | | - <Canvas Width="24" Height="24"> |
| 263 | + <Canvas Width="24" Height="24" Background="Transparent"> |
246 | 264 | <Path x:Name="Graphic" |
247 | 265 | Data="M19,3H5C3.89,3 3,3.89 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5C21,3.89 20.1,3 19,3M19,5V19H5V5H19Z" |
248 | 266 | Fill="{TemplateBinding Foreground}" /> |
|
0 commit comments