开发者

wpf: Label in toolbar gets clipped

If I create a toolbar with a label and a button like this:

    <ToolBar Height="26" >
        <Label>Hi mom</Label>
        <Button>Press me</Button>
    </ToolBar>

The button text centers on the toolbar and does not get clipped.

wpf: Label in toolbar gets clipped

How can I make the text on the label appear with an equal apperanc开发者_StackOverflow中文版e as the button?


Update

Here's how to do it with a Label (fixed Left/Right padding)

<ToolBar Height="26" >
    <Label Padding="5,0,5,0" VerticalAlignment="Center">Hi mom</Label>
    <Button>Press me</Button>
</ToolBar>


Ok, I figured out the TextBlock version:

This creates a textblock which creates a similar apperance as the button:

        <TextBlock Margin="2 2 3 0"  VerticalAlignment="Center" Text="Press Me"></TextBlock>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜