Button Background RRS feed

  • Question

  • Hello,

    Somehow I can't get normal background color for the button control. There are only light colors instead of normal colors (light-red, light-green etc.). I checked the same in WPF - there is no problem, normal colors. The "Opacity" property is 1, the "Opacity mask" property is "Black". What's a problem?

    My XAML: <Button Content="dfg" Height="23" Name="bt1" Width="30" Background="Red" OpacityMask="Black" />

    By the way, on  TextBox, DatePicker, TabControl it works properly. On the Button, Grid, StackPanel - doesn't.


    Sunday, May 15, 2011 2:33 PM


  • Button control's template consist of many parts (Borders, Rectangles, etc.). Background property you setting is applied to some of them but not for all.

    The solution is to edit button's template (in Blend for example), and manually apply "{TemplateBinding Background}" to every part of control, until you have solid button background.

    Sunday, May 15, 2011 6:23 PM