BUG in datagrid?

Sep 30, 2008 at 9:33 AM
Hi

I think there is something going wrong.

I have some DataGridTextColumns which consume a style for displaying error visualizations like this

            <toolkit:DataGridTextColumn
                  Header="{StaticResource P.PackageName}"
                  ElementStyle="{StaticResource styTextBoxColumnStyleGif}"
                  DataFieldBinding="{Binding Path=PackageName, ValidatesOnDataErrors=True}"
            />
Here is my style:

         <Style x:Key="styTextBoxColumnStyleGif" TargetType="{x:Type TextBlock}">
            <Style.Triggers>
               <Trigger Property="Validation.HasError" Value="True">
                  <Setter Property="Background" Value="LightSalmon"/>
                  <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self},Path=(Validation.Errors)[0].ErrorContent}" />
               </Trigger>
            </Style.Triggers>
            <Setter Property="Validation.ErrorTemplate">
               <Setter.Value>
                  <ControlTemplate>
                     <DockPanel LastChildFill="True">
                        <Image DockPanel.Dock="Right" Stretch="None" Source="UserControls\ValExcl.gif" Margin="-17,0,0,0" />
                        <Border BorderBrush="Red" BorderThickness="1"> <AdornedElementPlaceholder /> </Border>
                     </DockPanel>
                  </ControlTemplate>
               </Setter.Value>
            </Setter>
         </Style>

When entering invalid data, the datagrid acts differently:
when pressing the TAB key to leave a cell, both the background is changed and the GIF is shown
when pressing the ENTER key to leave a cell, only the background changes, but the GIF does not show up

Is this a bug or am I missing something?

Regards
Klaus

Coordinator
Oct 1, 2008 at 2:15 PM
Yes, this is a bug and will be address in the v1 release.
Oct 26, 2010 at 10:13 PM

Hi, I am new in WPF, just want to check if the bug mentioned above fixed?

I use .Net 3.5 SP1

thanks,

magmuggy