Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have added one DatagridTemplateColumn in the datagrid as below:-
<my:DataGridTemplateColumn x:Name="columnRRange" Header="{x:Static MicroResources:Resources.RRangeDiskDosage}" Width="50" >
           <my:DataGridTemplateColumn.CellEditingTemplate>
               <DataTemplate>
                   <TextBox Text="{Binding RRange,ValidatesOnDataErrors=True, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged}"
                            FontFamily="{DynamicResource DefaultFontFamily}" FontSize="{DynamicResource NormalFontSize}" Style="{DynamicResource TextboxErrorStyle}">
                       <TextBox.IsEnabled>
                           <MultiBinding Converter="{StaticResource DataGridColumnEnableConverter}">
                               <Binding RelativeSource="{RelativeSource Mode=FindAncestor,AncestorType=local:BreakpointsGrid}" Path="CanUserUpdateRows"/>
                               <Binding Path="State"/>
                           </MultiBinding>
                       </TextBox.IsEnabled>
                   </TextBox>
               </DataTemplate>
           </my:DataGridTemplateColumn.CellEditingTemplate>
           <my:DataGridTemplateColumn.CellTemplate>
               <DataTemplate>
                   <TextBlock Text="{Binding RRange}" Tag="{Binding RRange, ValidatesOnDataErrors=True, NotifyOnValidationError=True}"
                              Style="{DynamicResource TextBlockErrorStyle}" FontFamily="{DynamicResource DefaultFontFamily}" FontSize="{DynamicResource NormalFontSize}"/>
               </DataTemplate>
           </my:DataGridTemplateColumn.CellTemplate>
       </my:DataGridTemplateColumn>

Binding item({Binding RRange}) is of int type. Suppose column contain default value as 10.
When I enter some invalid text(e.g. abc in int column) it gives me error which is valid.
But when I tab out, its not displaying the error text(i.e. abc) in column. It display the red border, but display old text(i.e. value 10) in the column.

Its not user frindly. Error text should be displayed in the column so user can change it.

Please let me the changes that are required.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900