GridControl / TableView更改所选项目的背景色

时间:2019-04-30 09:50:33

标签: wpf devexpress

我将如何在Devexpress Gridcontrol usinf Tableview中更改选定/重点项目的默认颜色以显示数据,这是我尝试过的:

<dxg:GridControl KeyboardNavigation.TabNavigation="None" SelectionMode="Row" AutoGenerateColumns="none"  x:Name="gridDokumenti" IsTabStop="False" Margin="0,0,-2,35" EnableSmartColumnsGeneration="True" >
        <dxg:GridControl.View>
            <dxg:TableView x:Name="tvOtp"  AllowPerPixelScrolling="True" IsTabStop="False" AllowEditing="true" NavigationStyle="Row" ShowFocusedRectangle="True" ShowCheckBoxSelectorInGroupRow="False" ShowGroupPanel="False" ShowSelectionRectangle="True">
                <dxg:TableView.RowStyle>
                    <dxg:DefaultStyle TargetType="{x:Type dxg:GridRowContent}">
                        <Setter Property="Background" Value="White"/>
                        <Setter Property="Foreground" Value="#FF201F35"/>
                        <dxg:DefaultStyle.Triggers>
                            <DataTrigger Binding="{Binding AlternateRow}" Value="True">
                                <Setter Property="Background" Value="{Binding View.ActualAlternateRowBackground}"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding SelectionState}" Value="Selected">
                                <Setter Property="Background" Value="#BFE2EAFD"/>
                                <Setter Property="Foreground" Value="#FF201F35"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding SelectionState}" Value="Focused">
                                <Setter Property="Foreground" Value="#FF201F35"/>
                                <Setter Property="Background" Value="#FFD9E5FF"/>
                            </DataTrigger>
                        </dxg:DefaultStyle.Triggers>
                    </dxg:DefaultStyle>
                </dxg:TableView.RowStyle>
            </dxg:TableView>

        </dxg:GridControl.View>
        <dxg:GridColumn FieldName="ime1" Header="Kupac" IsSmart="True" BestFitMode="VisibleRows" AllowBestFit="True" Width="150" Fixed="left" BestFitArea="Rows"/>
        <dxg:GridColumn FieldName="broj" Header="Broj" IsSmart="True" BestFitMode="VisibleRows" AllowBestFit="True" Width="60" Fixed="right" BestFitArea="Rows"/>
        <dxg:GridColumn FieldName="dat" Header="Datum" IsSmart="True" BestFitMode="VisibleRows" AllowBestFit="True" Width="50" Fixed="right" BestFitArea="Rows"/>
        <dxg:GridColumn FieldName="iznos" Header="Iznos" IsSmart="True" BestFitMode="VisibleRows" AllowBestFit="True"  Width="50" Fixed="right" BestFitArea="Rows"/>
    </dxg:GridControl>

但是我得到一个错误:

  

严重性代码描述项目文件行抑制状态   错误“背景”成员无效,因为它没有合格的类型名称。

0 个答案:

没有答案