문제

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>

...

도움이 되었습니까?

해결책

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">
  <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>

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top