I have created a ControlTemplate for checkbox using multiple path geometry. The code for the ControlTemplate is as below.
I want to position the inner hexagon in center of the outer hexagon, I am not getting how to do that. I tried using Margin but its not working to make it perfect center.
- <ControlTemplate x:Key="checkboxTemplateHex" TargetType="CheckBox">
- <Grid>
- <Path x:Name="Equis2" Opacity="1" StrokeThickness="1" Stroke="YellowGreen" Fill="Transparent" Data="M7.99999993117449,0.5L15.4999998937224,4.25L15.4999998937224,11.75L7.99999993117449,15.5L0.499999968626539,11.75L0.499999968626537,4.25z"/>
- <Path x:Name="Equis" Opacity="1" StrokeThickness="0" Stroke="YellowGreen" Fill="YellowGreen" Data="M5.5,0L10.999999995477,2.75L10.999999995477,8.25L5.5,11L4.52300163988895E-09,8.25L4.52300019659901E-09,2.75z"/>
- <ContentPresenter Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
- </Grid>
- </ControlTemplate>
Using this ControlTemplate as following
- <CheckBox Grid.Row="5" Grid.Column="1" Template="{StaticResource checkboxTemplateHex}" FocusVisualStyle="{x:Null}" IsChecked="True"/>
Following is the output