Hello,
I have created this style in XamCalendar Resources. I have the SelectedDate property binds two to a business Object that conducts validations on this property.
The error provider is not appearing when the property in the error state.
Please note, I have used the same style on a XamDataGrid and it works properly.
Thank you
<igDP:XamDataGrid.Resources> <Style x:Key="{x:Static igDP:DataPresenterBase.DataErrorIconStyleKey}" TargetType="{x:Type Control}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Control}"> <DockPanel> <Border Background="Red" Width="25" Height="25" CornerRadius="10"> <TextBlock Text="!" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Foreground="White" /> </Border> </DockPanel> </ControlTemplate> </Setter.Value> </Setter> </Style>
Hello User101,
Thank you for contacting Infragistics.
A standalone XamCalendar does not support error handling and validation since it's not considered an input control like the xamDataGrid. The XamDateTimeEditor, which I recommend using, and the rest of our editors support this functionality. They provide ValueContraints to check when the user inputs invalid data.
http://help.infragistics.com/Help/Doc/WPF/2016.1/CLR4.0/html/InfragisticsWPF4.Editors.v16.1~Infragistics.Windows.Editors.ValueConstraint.html
Let me know if you have any questions.
Hi Michael,
Thank you for the reply.
XamDateTimeEditor does it.
I'm applying this style to an infragistics control XamDateTimeEditor. The new error icon displays as expected.
infragistics
XamDateTimeEditor
issue: The original error style is still displaying when a validation error occurs. Thus making the control to have two error icon styles.
<Style TargetType="{x:Type XamDateTimeEditor}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type Control}"><DockPanel><Border Background="Red" Width="25" Height="25" CornerRadius="10"><TextBlock Text="Error" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Foreground="White" /></Border></DockPanel></ControlTemplate></Setter.Value></Setter></Style>
Hello User 101,
Thank you for following up. I am glad you were able to get the error icon displayed. Do you have any additional questions or concerns at this time?
Hello Michael,
As I indicated in my previous reply, The original error style is still displaying when a validation error occurs. Thus making the control to have two error icon styles.
You can find the style I'm using in my previous comment.
I appreciate a prompt response.
<Style x:Key="ErrStyle" TargetType="{x:Type ig:XamDateTimeEditor}">
<Setter Property="Validation.ErrorTemplate"> <Setter.Value> <ControlTemplate> <DockPanel LastChildFill="True"> <Border Background="Red" DockPanel.Dock="Right" Margin="5,0,0,0" Width="20" Height="20" CornerRadius="5" ToolTip="{Binding AdornedElement.(Validation.Errors).CurrentItem.ErrorContent, ElementName=customAdorner}"> <TextBlock Text="!" VerticalAlignment="Center" HorizontalAlignment="Center" FontWeight="Bold" Foreground="White" /> </Border> <AdornedElementPlaceholder x:Name="customAdorner" VerticalAlignment="Center"> <Border BorderBrush="red" BorderThickness="1" /> </AdornedElementPlaceholder> </DockPanel> </ControlTemplate> </Setter.Value> </Setter> </Style>