Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
65
DataErrorDisplayMode for inline error
posted

We are using DataErrorDisplayMode for inline error in our grids. We are using ErrorIconAndHighlight property and adjusted to use our own image. Everything displays correctly, however, with the Highlight property we get a red outline around the cell and a cell fill (light red). We only want the red outline, we do not want the fill. Is there a way to adjust this so that we can eliminate the light red fill and keep the red outline only?

The image to the left is now it now appears, the image on the right is how we want it to appear.

Thanks for your help.

Parents
No Data
Reply
  • 20
    Suggested Answer
    posted

    Please look into this post for styling data errors.

    http://help.infragistics.com/Help/NetAdvantage/WPF/2011.1/CLR4.0/html/xamDataPresenter_Styling_Data_Errors.html

    This is how it looks like for me.

    For your convenience I have assembled all the code and tweaked it for your requirement.

    Place this code in XamDataGrid.Resources

    Code Snippet
    1. <DataTemplate x:Key="{x:Static igDP:DataPresenterBase.DataErrorContentTemplateKey}">
    2.     <Grid Background="#FFFFFFFF">
    3.         <Grid.ColumnDefinitions>
    4.             <ColumnDefinition Width="Auto" />
    5.             <ColumnDefinition Width="*" />
    6.         </Grid.ColumnDefinitions>
    7.         <ContentPresenter ContentTemplate="{x:Null}" Grid.Column="1" />
    8.         <Control Grid.Column="0"
    9.                     Name="errorIcon"
    10.                     Visibility="Collapsed"
    11.                     Style="{DynamicResource {x:Static igDP:DataPresenterBase.DataErrorIconStyleKey}}"
    12.                     Margin="4,0,2,0"
    13.                     ToolTip="{Binding Host.DataError}" />
    14.         <Border Name="errorHighlight" BorderBrush="#FF944E4E" BorderThickness="1" Visibility="Collapsed" Grid.ColumnSpan="2" />
    15.     </Grid>
    16.     <DataTemplate.Triggers>
    17.         <MultiDataTrigger>
    18.             <MultiDataTrigger.Conditions>
    19.                 <Condition Binding="{Binding Host.HasDataError}" Value="True" />
    20.                 <Condition Binding="{Binding Host.IsDataErrorDisplayModeIcon}" Value="True" />
    21.             </MultiDataTrigger.Conditions>
    22.             <Setter TargetName="errorIcon" Property="Visibility" Value="Visible" />
    23.         </MultiDataTrigger>
    24.         <MultiDataTrigger>
    25.             <MultiDataTrigger.Conditions>
    26.                 <Condition Binding="{Binding Host.HasDataError}" Value="True" />
    27.                 <Condition Binding="{Binding Host.IsDataErrorDisplayModeHighlight}" Value="True" />
    28.             </MultiDataTrigger.Conditions>
    29.             <Setter TargetName="errorHighlight" Property="Visibility" Value="Visible" />
    30.         </MultiDataTrigger>
    31.     </DataTemplate.Triggers>
    32. </DataTemplate>

    If you don't have style for icon place this in XamDataGrid.Resources as well

    Code Snippet
    1. <Style TargetType="{x:Type Control}" x:Key="{x:Static igDP:DataPresenterBase.DataErrorIconStyleKey}">
    2.     <Setter Property="Template">
    3.         <Setter.Value>
    4.             <ControlTemplate TargetType="{x:Type Control}">
    5.                 <Image Width="10" Height="10" Source="/your_error_icon_location.png"/>
    6.             </ControlTemplate>
    7.         </Setter.Value>
    8.     </Setter>
    9. </Style>

    Regards
    Anil Vangari

Children
No Data