Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change width of checkable area of checkbox

Tags:

wpf

I have a CheckBox object and it doesn't have any text associated with it. It is in a Grid which has another coulmn used as the label for it. The whitespace next to the checkbox you can click and it will toggle checkbox I want it just be the area of the actual checkbox and not the white space around it(because the text for it is set to nothing).

I tried setting the width = 5 but that didn't make a difference

thank you very much!!

like image 202
user565660 Avatar asked Jun 21 '11 16:06

user565660


1 Answers

It sounds like your CheckBox is stretching to the whole width of the grid cell (with all of that width clickable), and you don't want it to stretch.

Set the CheckBox's HorizontalAlignment property to Left (or Center, or Right). Then it will be exactly the width it needs to be for the checkbox, rather than stretching to the entire width provided by its parent.

like image 91
Joe White Avatar answered Oct 25 '22 07:10

Joe White