c# - 如何为 WPF DataGrid 制作条纹颜色?

标签 c# wpf xaml datagrid

问题很简单:如何实现 WPF 数据网格的条纹颜色,如下所示:

stripe colors

这会修改每一行以包含灰色背景,现在我需要改进它:

<Style TargetType="{x:Type DataGridCell}">
    <Setter Property="Background" Value="#aaa" />
</Style>

最佳答案

您可以为此使用 DataGrid 的 AlternatingRowBackground 属性。

关于c# - 如何为 WPF DataGrid 制作条纹颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9723954/

相关文章:

wpf - 在非主 TabItem 内时,绑定(bind)在 DataGrid 列标题中不起作用

xaml - Xamarin.Forms bindingContext 将源设置回根/父

c# - 使用 NetNamedPipe 的 WCF 多个应用程序

c# - RxUI - WPF - 不带 DataContext 的样式 DataTrigger 绑定(bind)

C# 3.5 读取Excel文件

C# WPF ListView 更新

c# - TabControl 项目标题文本在旋转选项卡后显得模糊

c# - 带空格的 WPF/XAML ResourceDictionary

c# - 为什么 Moq 看不到在 .Select 方法中调用此方法?

c# - MySql 数据库中的 EF 重命名列