TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Neeraj Khajanchi
NA
12
15.5k
How to position inner path hexagon center in checkbox?
Jan 4 2018 7:11 AM
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
Reply
Answers (
1
)
AutoComplete Textbox in WPF use SQL server
how we use Window.xaml as mdi child in wpf