【问题标题】:DevExpress master detail row cell styleDevExpress 主从行单元格样式
【发布时间】:2017-07-07 13:05:18
【问题描述】:

我想根据某些条件更改我的 gridview 的主详细信息行样式。我的代码是这样的;

        GridView newDetailView = grdLog.CreateView("GridView") as GridView;
        GridView View = sender as GridView;
        gvLog.MasterRowGetLevelDefaultView += (s, e2) =>
        {
            if (e.RowHandle >= 0)
            {
                for (int i = 0; i < gvLog.Columns.Count - 15; i++)
                {
                    string strTimeKey1 = View.GetRowCellDisplayText(e.RowHandle, View.Columns[i]);
                    string strTimeKey2 = View.GetRowCellDisplayText(View.FocusedRowHandle, View.Columns[i]);
                    if (!strTimeKey1.Equals(strTimeKey2))
                    {
                        e.Appearance.BackColor = Color.Red;
                    }
                }

            }
        };

我的父行和明细行有相同的列,它必须像如果明细行的列值与父行的列值不同,单元格颜色将为红色。

【问题讨论】:

    标签: c# gridview devexpress master-detail


    【解决方案1】:

    发件人:How To Dynamically Format Columns For A Detail View

    MasterRowExpanded 事件发生时,列已经创建 发生。请尝试使用此事件根据需要自定义它们, 并让我知道此解决方案是否满足您的需求。

    参考这些 DevExpress 线程:
    Style conditions conditional formatting for master and detail views
    How to set row style of Detail grid records after data binded to xtragrid master-detail data Master/Detail grid with StyleFormatCondition

    【讨论】:

    • 谢谢。我会试试的。 @NiranjanKala
    猜你喜欢
    • 2012-05-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多