因此,在xceed文档中,有一个代码示例对我不起作用。这可能是因为我的网格绑定到DataGridCollectionView。 DataGridCollection使用的集合中的对象是实现IDATAERRORINFO的。

错误显示的很好。问题在于他们使用默认的橙色背景来解决错误...我需要一个红色边框。以下是我网格的XAML实例化。我将Datacell背景属性设置为RED,这样我就可以确定我可以访问网格的属性...我做到了。我只是找不到识别单元格w/ w/错误的方法,以便我可以对它们进行样式。谢谢!

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

...

有帮助吗?

解决方案

知识库的条目:

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

似乎确实缺少关键作品。

你尝试过吗 CellErrorStyle属性 在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