Padding (left, top, right, bottom) in WPF

Lukasz Madon picture Lukasz Madon · Jul 24, 2010 · Viewed 42.1k times · Source

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?

Answer

Lunivore picture Lunivore · Jul 24, 2010

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.