Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将datagrid行颜色绑定到WPF中的单元格值_Wpf_Datagrid_Styling - Fatal编程技术网

将datagrid行颜色绑定到WPF中的单元格值

将datagrid行颜色绑定到WPF中的单元格值,wpf,datagrid,styling,Wpf,Datagrid,Styling,我在WPF中有一个datagrid,其中一列是我希望设置的行的颜色。如何将行的颜色设置为该字段的值(例如#FF7B68EE) <DataGrid Grid.Column="0" Grid.Row="4" Name="dgBank" ItemsSource="{Binding Path=bankTable.dataTable.DefaultView}" AutoGenerateColumns="TRUE" CanUserAddRows="False" CanUserDeleteRows="F

我在WPF中有一个datagrid,其中一列是我希望设置的行的颜色。如何将行的颜色设置为该字段的值(例如#FF7B68EE)

<DataGrid Grid.Column="0" Grid.Row="4" Name="dgBank" ItemsSource="{Binding Path=bankTable.dataTable.DefaultView}" AutoGenerateColumns="TRUE" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" />

我使用了@codeBlue在对我问题的评论中指出的答案


我使用了@codeBlue在对我问题的评论中指出的答案



查看此链接:@codeBlue有效,谢谢。查看此链接:@codeBlue有效,谢谢。
<DataGrid Grid.Column="0" Grid.Row="4" Name="dgBank" ItemsSource="{Binding Path=bankTable.dataTable.DefaultView}" AutoGenerateColumns="TRUE" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False">
    <DataGrid.RowStyle>
        <Style TargetType="DataGridRow">
            <Setter Property="Background" Value="{Binding colorColumn}"/>
        </Style>
    </DataGrid.RowStyle>
</DataGrid>