Lukasz Madon Lukasz Madon - 11 months ago 91
C# Question

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

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 Source

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.