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.
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>
Hi Micheal,
Any advise on this one.
Thanks,
Hello User 101,
Thank you for following up. Please send a screenshot. It sounds like the datagrid validation is also appearing with the editor.
Micheal, I have no datagrid involved. When I have copied the code over I was trying different things, I forgot to revert.
I have the XamDateTimeInput sitting in a StackPanel.
The error icon messages appearing are the same. Which tells me that the error provider Template is not overridden. It looks like it is adding another template to this one.
Thank you for following up. Okay then the style will probably need to be embedded within the control instead as a higher level resource on the window for example. That way the control won't override your new style. I will work on implementing this today.
I attached a sample. However there appears to be some confusion about which control you are trying to restyle. I do not recommend using the XamDateTimeInput since it doesn't support customized error validation in the manner in which you are showing. Using a ViewModel to provide a customized validation error messages is the best advice.