This project has moved. For the latest updates, please go here.

Change color of spinner button for decimalupdown

Oct 8, 2014 at 9:31 AM
Hi

So what I attempting to do is to change the background color of the buttons used within the DecimalUpDown controls;
         xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
         xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes;assembly=Xceed.Wpf.Toolkit"

        <Style TargetType="{x:Type xctk:DecimalUpDown}">
            <Style.Resources>
                <LinearGradientBrush x:Key="{x:Static themes:ResourceKeys.ButtonNormalBackgroundKey}"
                    StartPoint="0,0"
                    EndPoint="0,1">
                    <LinearGradientBrush.GradientStops>
                        <GradientStopCollection>
                            <GradientStop Color="red"
                      Offset="0" />
                            <GradientStop Color="red"
                      Offset="0.5" />
                            <GradientStop Color="red"
                      Offset="0.5" />
                            <GradientStop Color="red"
                      Offset="1" />
                        </GradientStopCollection>
                    </LinearGradientBrush.GradientStops>
                </LinearGradientBrush>
            </Style.Resources>
        </Style>
Ignore the colors all being red, these will change two another gradient, however this simply does not work. What am I doing wrong ???

Regards
Developer
Oct 8, 2014 at 1:22 PM
Hi,

Your code works in Windows8. I believe you are not working with Windows8.
Try to add the following in file Xceed.Wpf.Toolkit/Themes/Generic/Buttons.xaml
in the "SpinnerButtonStyleKey"
<Setter Property="Background" Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonNormalBackgroundKey}}" />
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonNormalOuterBorderKey}}" />
Tell me if it helps.
Thanks.