【问题标题】:Make detailed list readonly in master-detail grid view in the DevExpress control在 DevExpress 控件的主从网格视图中将详细列表设为只读
【发布时间】:2018-09-12 16:16:39
【问题描述】:

您能告诉我如何在DevExpress 的主从GridView 中将详细列表设为只读吗? GridView.Columns[columnIndex].ColumnEdit 属性为空。当我尝试像下面这样制作新的 RepositoryItem 时:

private void gridView_MasterRowExpanded(object sender, CustomMasterRowEventArgs e)
{
    var masterView = sender as GridView;
    GridView detailView = masterView?.GetDetailView(e.RowHandle, e.RelationIndex) as GridView;
    if(detailView == null) return;

    RepositoryItem ri = new RepositoryItem() { ReadOnly = true };
    detailView.Columns[0].ColumnEdit = ri;
}

它在视图中返回空单元格。

【问题讨论】:

    标签: c# winforms gridview devexpress


    【解决方案1】:

    RepositoryItem 是一个基类,不应直接在您的代码中使用。如果您需要将列设为只读,请将 GridColumn.OptionsColumn.ReadOnly 属性设置为 true。

    我还建议阅读Modify and Validate Cell Values 帮助文章以获取有关这方面的更多信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-02-22
      • 1970-01-01
      • 1970-01-01
      • 2013-01-08
      • 2011-12-13
      • 1970-01-01
      • 1970-01-01
      • 2012-08-06
      相关资源
      最近更新 更多