This is a migrated thread and some comments may be shown as answers.

GridViewColumn Custom Validation Error Template

2 Answers 326 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Sai
Top achievements
Rank 1
Sai asked on 26 Oct 2011, 11:27 AM
I would like to override the original error template to do the following
- add an warning icon at the back of the control
- add the error content to the tooltip of the icon with converter to convert the error content from error code to error message for validation from Model that implemented IDataErrorInfo interface.

I tried to do it as follows but it doesn't work. Is there anything wrong or there is another solution in handling this case?

 

<ControlTemplate x:Key="GeneralErrorTemplate">  

<Grid>

<Border BorderBrush="#66FF0000" BorderThickness="3">

<AdornedElementPlaceholder x:Name="adorner" />

</Border>

<Image Source"/Images/error.png"

ToolTip="{Binding ElementName=adorner, Path=AdornedElement.(Validation.Errors).CurrentItem.ErrorContent, Converter={x:Static con:CodeConverter.Instance}}">
</Image>
</Grid>

</ControlTemplate>

<telerik:GridViewDataColumn Header="Value" DataMemberBinding="{Binding Value, Mode=TwoWay, ValidatesOnDataErrors=True}" Validation.ErrorTemplate="{StaticResource GeneralErrorTemplate}">  

</telerik:GridViewDataColumn>

 

2 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 29 Oct 2011, 05:11 PM
Hi Sai,

 


You may simply predefine the template of GridViewEditorPresenter using Blend and modify the ValidationToolTipTemplate contained in it. Mark this style as an implicit one and it will be handled correspondingly.  If you need sample project I will be glad to prepare small demo illustrating this approach. 



Best wishes,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Sai
Top achievements
Rank 1
answered on 31 Oct 2011, 03:58 AM
I'm a newbie in using Blend to define the template of GridViewEditorPresenter. Would you give more advice on that or provide some examples? Thanks a lot.
Tags
GridView
Asked by
Sai
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Sai
Top achievements
Rank 1
Share this question
or