Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
30
XamNumericInput - Override default style
posted

Hi,

Im currently trying to achieve that the XamNumericInput has the same style as the rest of my textboxes. So i thought just copy the style and change the TargetType to XamNumericInput. But somehow i am ending up with a textbox i cannot interact with and not showing its value. What im doing wrong here?

Here is my xaml:

<Style x:Key="XamNumericInputStyle"
               TargetType="{x:Type ig:XamNumericInput}">
            <Setter Property="Background"
                    Value="{StaticResource ControlDarkBrush}" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ig:XamNumericInput">
                        <Border Name="Border"
                                Padding="2"
                                Background="{TemplateBinding Property=Background}"
                                BorderBrush="{StaticResource BorderMediumBrush}"
                                BorderThickness="1"
                                CornerRadius="2">
                            <ScrollViewer Name="PART_ContentHost" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsReadOnly" Value="True">
                                <Setter TargetName="Border"
                                        Property="Focusable"
                                        Value="False" />
                                <Setter TargetName="Border"
                                        Property="Background"
                                        Value="{StaticResource DisabledControlDarkBrush}" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter TargetName="Border"
                                        Property="Focusable"
                                        Value="False" />
                                <Setter TargetName="Border"
                                        Property="Background"
                                        Value="{StaticResource DisabledControlDarkBrush}" />
                            </Trigger>
                            <Trigger Property="IsFocused" Value="True">
                                <Setter TargetName="Border"
                                        Property="Background"
                                        Value="{StaticResource ControlSelectedFocusedBrush}" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Margin"
                    Value="4,4,4,4" />
            <Setter Property="HorizontalAlignment"
                    Value="Stretch" />
            <Setter Property="MaxHeight"
                    Value="27" />
            <Setter Property="MinWidth"
                    Value="100" />
        </Style>