2010-05-17 52 views
0

所以在Xceed文档中有一个代码示例不适用于我。这可能是因为我的网格绑定到DataGridCollectionView。 datagrid集合使用的集合中的对象是实现IDataErrorInfo的对象。如何更改Xceed Datagrid的CellErrorStyle?

错误显示正常。问题是他们正在使用默认的橙色背景进行错误...我需要一个红色边框。以下是我的网格的XAML实例化。我将DataCell背景属性设置为红色,这样我就可以确定我可以访问网格的属性......我知道。我无法找到识别单元格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> 

...

回答

1

知识库录入:

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

似乎是有可能漏掉一个关键部分。

你试过DataGridView上的CellErrorStyle Property吗?

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

+0

你钉它。是的,文档中非常明显的遗漏,使得它看起来像他们在他们的风格(cell_error)上使用的关键词是某种保留字。非常令人沮丧。谢谢! – Bob 2010-05-18 14:08:39

相关问题