Hi IG Team!
In one of our projects we had the requirement to defined a custom ErrorTemplate (Tooltip) for all of our input controls. The template has a special layout (Header, Body and Footer) and shows relevant information.
Is there a way how we can use the same template for the Editors (e.g. XamTextEditor) within the XamDataGrid? We tried the Validation.ErrorTemplate DP without success. Furthermore the same template should be applied, whether the cell is in edit mode or during mouse-hover.
Best regards,
Hico
Hello hico,
I have been looking into your question and in order to perform validation and display a custom message in the tooltip xamDataGrid’s Editors, you can implement the IDataErrorInfo interface into your data source object. I have prepared a sample project, that demonstrates the described approach. You can also take a look in the Feature Browser’s example and check if there are other features that you desire to reuse within your project (can be found under xamDataGrid -> themes and Styles -> data Error Style) .
The custom validation can be executed from the event handler of the Editors MouseEnter event as well.
Can you please take a look at the sample provided and let me know if this implementation meets your requirements or I have misunderstood you at some point.
Sincerely,
Ekaterina
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support
Dear Ekaterina,
Thank you for your help so far!
The situation with these Tooltips is the following:
We would like to have different tooltips for a XamTextEditor (within a XamDataGrid) in case its value is valid, and in case the validation has failed for this value.
In case of other controls we use MultiTriggers to show a tooltip with the description of the error in it:
For example: in case of the style: DefaultEditControlSytle:
<MultiTrigger> <MultiTrigger.Conditions> <Condition Property="Validation.HasError" Value="True" /> <Condition Property="IsEnabled" Value="True" /> </MultiTrigger.Conditions> <MultiTrigger.Setters> <Setter Property="BorderBrush" Value="{StaticResource ErrorBorderBrush}" /> <Setter Property="Background" Value="{StaticResource ErrorBackgroundBrush}" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="ToolTipService.ShowDuration" Value="10000" /> <Setter Property="ToolTip" Value="{StaticResource ErrorToolTip}" /> </MultiTrigger.Setters> </MultiTrigger>
As you can see, this way we can show a different tooltip in case the validation has failed. We would like to create a similar solution in case of a XamTextEditor (within a XamDataGrid), but to be able to do that, we need to know for which Style we have to make a similar trigger as written above.
Thank you for your help!