简体   繁体   中英

C# WPF How do I add a border to a style?

I'm creating a style for buttons in App.xaml. How can I add a border to the style? And how can I then use the style in MainWindow.xaml?

I couldn't find how to do it. I don't want to put it in a separate style for the sake of border.

in App.xaml

        <Style x:Key="BorderedButton" TargetType="Button">
            <Setter Property="BorderBrush" Value="HotPink"/>
            <Setter Property="BorderThickness" Value="2"/>
        </Style>

and in the view

        <Button Style="{StaticResource BorderedButton}"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM