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
435
XamNumericInput Validation.ErrorTemplate
posted

Hi Infragistics,

We have a Style for a XamNumericInput which is working well. When we attempt to apply our standard ErrorTemplate onto this Style, it doesn't seem to work.

The full style is as follows...

    <Style x:Key="XamNumericInputPartNumber" TargetType="{x:Type ig:XamNumericInput}">
        <Setter Property="Width" Value="50"/>
        <Setter Property="Margin" Value="5"/>
        <Setter Property="ValueTypeName" Value="Int32"/>
        <Setter Property="SpinButtonDisplayMode" Value="Always"/>
        <Setter Property="PromptChar" Value=""/>
        <Setter Property="Mask" Value="{}{number:1-999}"/>
        <Setter Property="Validation.ErrorTemplate">
            <Setter.Value>
                <ControlTemplate>
                    <DockPanel LastChildFill="True">
                        <Border Background="Blue" DockPanel.Dock="Right" Margin="5,0,0,0" Width="20" Height="20" CornerRadius="10" ToolTip="{Binding ElementName=customAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}">
                            <TextBlock Text="!" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Foreground="White"/>
                        </Border>
                        <AdornedElementPlaceholder Name="customAdorner" VerticalAlignment="Center">
                            <Border BorderBrush="Blue" BorderThickness="1"/>
                        </AdornedElementPlaceholder>
                    </DockPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

I've attached an example of what the ErrorTemplate should look like.

Any help would be much appreciated.

Regards, ifdef

Parents
No Data
Reply
  • 435
    posted

    I should add...

    We're not trying to validate the number that's entered as such. The mask of 1-999 takes care of that.

    Post entry, we need to check that the particular number is not reserved, just before the user clicks Save. If the number is reserved, we use IDataErrorInfo to set the relevant error for that property.

Children