tags:

views:

84

answers:

2

What I want to have is a button with a bit of left and right padding. I can set the MinWidth to some val, but if the Content will be changed it may not be enough.

 <Button MinWidth="75" Padding="2" Content="It speaks!" />

Is it possible to simulate something like Padding.left/right in WPF?

A: 

I'm not familiar with WPF but i think it can be

<Button MinWidth="75" Padding="left,top,right,bottom" Content="It speaks!" />

So for 3 top padding, 4 left, 5 bottom and 2 left.

<Button MinWidth="75" Padding="2,3,4,5" Content="It speaks!" />
Semas
Wouldn't it be nice if it had the same order as CSS? Unfortunately it doesn't - it's left, top, right, bottom. Heaven forbid that Microsoft should ever support an established standard.
Lunivore
Nope, it's left, top, right, bottom.
Erv Walter
True, but it's rare that Microsoft do in a way everyone would like to.
Semas
+3  A: 

I believe both Margins and Padding work with Thickness, which can either be described as a single integer or as a list of four: Padding="3, 10, 30, 10" for instance.

The order is left, top, right, bottom - which is annoyingly not the same as CSS.

Lunivore
ah ye they are Thickness objects. thx
lukas