开发者

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?


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.


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 2 left padding, 3 top, 4 right, and 5 bottom:

<Button MinWidth="75" Padding="2,3,4,5" Content="It speaks!" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜