【问题标题】:Changing Row Color by specific Condition WPF Datagrid通过特定条件 WPF Datagrid 更改行颜色
【发布时间】:2015-08-25 20:08:54
【问题描述】:

我和这个人有同样的问题:

How to change row color in datagridview?

不同之处在于我使用 WPF。所以 .rows 不存在。 你们中有人知道如何解决这个问题吗?

【问题讨论】:

标签: row background-color


【解决方案1】:

我是这样解决的:

private void dgAnzeigeKostenstelle_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            try
            {
                if (Convert.ToInt32(((System.Data.DataRowView)(e.Row.DataContext)).Row.ItemArray[5]) > Convert.ToInt32(((System.Data.DataRowView)(e.Row.DataContext)).Row.ItemArray[4]))
                {
                    e.Row.Background = new SolidColorBrush(Colors.OrangeRed);
                } 
            }
            catch
            {
            } 
        }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-16
    • 1970-01-01
    • 2013-10-17
    • 1970-01-01
    • 1970-01-01
    • 2016-06-04
    • 2015-08-22
    相关资源
    最近更新 更多