views:

101

answers:

1

So in the Xceed documentation there is a code example that does not work for me. It may be because my grid is bound to a DataGridCollectionView. The objects in the collection used by the datagridcollection are what implement IDataErrorInfo.

The errors are showing up just fine. The problem is that they are using the default orange background for errors...I need a red border. Below is the XAML instantiation of my grid. I set the DataCell background property to red just so I could be sure I had access to the grid's properties... I do. I just can't find the way to identify the cell's w/ errors so I can style them. Thanks!

        <XceedDG:DataGridControl Grid.Row="1" Grid.ColumnSpan="5" ItemsSource="{Binding Path = ABGDataGridCollectionView, UpdateSourceTrigger=PropertyChanged}"
                                     Background="{x:Static Views:DataGridControlBackgroundBrushes.ElementalBlue}" IsDeleteCommandEnabled="True"
                                     FontSize="16" AutoCreateColumns="False" x:Name="EncounterDataGrid" AllowDrop="True">

        <XceedDG:DataGridControl.View>
            <Views:TableView ColumnStretchMode="All" ShowRowSelectorPane="True" 
                     ColumnStretchMinWidth="100">
                <Views:TableView.FixedHeaders>
                    <DataTemplate>
                        <XceedDG:InsertionRow Height="40"/>
                    </DataTemplate>
                </Views:TableView.FixedHeaders>
            </Views:TableView>

        </XceedDG:DataGridControl.View>
        <!--Group Header formatting-->
        <XceedDG:DataGridControl.Resources>
            <Style TargetType="{x:Type XceedDG:GroupByControl}">
                <Setter Property="Visibility" Value="Collapsed"/>
            </Style>
            <Style TargetType="{x:Type XceedDG:DataCell}">
                <Setter Property="Background" Value="Red"/>
            </Style>
        </XceedDG:DataGridControl.Resources>

...

+1  A: 

The knowledge base entry:

http://xceed.com/KB/questions.php?questionid=256

Does seem to be potentially missing a critical piece.

Did you try the CellErrorStyle Property on DataGridView?

<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"&gt;
  <Grid.Resources>
    <Style x:Key="errorStyle" TargetType="{x:Type xcdg:DataCell}">
      <Setter Property="Foreground" Value="Red"/>
    </Style>
  </Grid.Resources>

  <xcdg:DataGridControl CellErrorStyle="{StaticResource errorStyle}" >
       <!--STUFF OMITTED-->
  </xcdg:DataGridControl>
</xcdg:DataGridControl>

ee
You nailed it. Yeah, pretty glaring omission in the documentation which makes it look like the key word they used on their style (cell_error) was some kind of reserved word. Very frustrating. Thanks!
Bob