Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to set inner text margin of button

Tags:

I have a WPF button with some text in it. If I don't set button's width manually, then the button width will be almost of text's width, and it doesn't look very good. I don't want to calculate the width of each button. Is there a more convenient way to specify the relative width of the button? For example in CSS you can specify padding or margin. Is there something like that in WPF?

like image 204
Bogdan Verbenets Avatar asked Nov 02 '11 14:11

Bogdan Verbenets


People also ask

How do I give a button a margin in HTML?

The margin property sets or returns the margins of an element. This property can take from one to four values: One value, like: div {margin: 50px} - all four margins will be 50px. Two values, like: div {margin: 50px 10px} - the top and bottom margins will be 50px, left and right margins will be 10px.

What is the difference between margin and padding properties?

In CSS, a margin is the space around an element's border, while padding is the space between an element's border and the element's content. Put another way, the margin property controls the space outside an element, and the padding property controls the space inside an element.


1 Answers

You can set the Button's Padding

<Button Content="Test" Padding="5,2" /> 
like image 139
Rachel Avatar answered Oct 25 '22 08:10

Rachel