How to increase the space between the checkbox and the text associated with it?

I am using WPF and I have a CheckBox element with related text / content. I changed the FlowDirection to RightToLeft so that this flag is to the right of the text. But it is very close to the text. I would like to increase the interval between the text and the checkbox, but of course the Margin option changes the outer margins of the entire control. Thanks for any ideas.

<CheckBox IsChecked="True" HorizontalAlignment="Left" FlowDirection="RightToLeft">Activate</CheckBox> 
+6
source share
3 answers

This should work too:

 <CheckBox> <TextBlock Margin="10 0 0 0">Activate</TextBlock> </CheckBox> 
+6
source
+10
source

By default, xaml makes the checkbox invalid. Change <Checkbox /> to <CheckBox></CheckBox> and add a text block inside the tag to add content. Add padding to change field alignment.

 <CheckBox x:Name="ChkExcel" Grid.Column="0" Grid.Row="3" Margin="0 3 0 3"> <TextBlock Padding="10 2 0 0">Microsoft Office Excel</TextBlock> </CheckBox> 
0
source

Source: https://habr.com/ru/post/906773/


All Articles