Transparent button background in WPF using style

前端 未结 4 1558
-上瘾入骨i
-上瘾入骨i 2021-02-14 17:32

I\'ve found this topic about setting the border of a button to transparent. This works fine, but I want to use this for the button background and not the border.

Soluti

4条回答
  •  忘掉有多难
    2021-02-14 17:36

    Use this in C# code

    Button btn = new Button() {BorderBrush=System.Windows.Media.Brushes.Transparent, 
                                   BorderThickness = new Thickness(0)};
    

    or

    yourBtn.BorderBrush=System.Windows.Media.Brushes.Transparent;
    yourBtn.BorderThickness =new Thickness(0);
    

提交回复
热议问题