开发者

WPF Button No Border No Background

开发者 https://www.devze.com 2023-04-13 05:59 出处:网络
I just need a button so simple that it looks like a TextBlock.Some time ago I saw an answer on SO to style the button based on a static style for a button in a menu but I cann开发者_运维知识库ot find

I just need a button so simple that it looks like a TextBlock. Some time ago I saw an answer on SO to style the button based on a static style for a button in a menu but I cann开发者_运维知识库ot find that answer (and I have been searching for an hour). Does anyone know what system style I am referring to and the syntax to apply that style to a button?


Is it maybe the style used for a button in a ToolBar that you're referring to? The ToolBar control overrides the Button style so they appear flat. You can apply that style to a button like this...

<Button Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" />


If you want a button that looks like a TextBlock, you can make a button that is a TextBlock.

<Button Content="I'm a Button; click me">
    <Button.Template>
        <ControlTemplate TargetType="Button">
            <TextBlock Text="{TemplateBinding Content}" />
        </ControlTemplate>
    </Button.Template>
</Button>
0

精彩评论

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

关注公众号