简体   繁体   English

在DevExpress控件的主从网格视图中将详细列表设为只读

[英]Make detailed list readonly in master-detail grid view in the DevExpress control

Can you give me an answer how to make detailed list read-only in master-detail GridView in DevExpress ? 您能否给我一个答案,如何在DevExpress master-detail GridView中使详细列表为只读? The GridView.Columns[columnIndex].ColumnEdit property is null. GridView.Columns[columnIndex].ColumnEdit属性为null。 When I try to make new RepositoryItem like bellow: 当我尝试像下面这样制作新的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;
}

It returns empty cell in the view. 它在视图中返回空单元格。

RepositoryItem is a base class and should not be used directly in your code. RepositoryItem是基类,不应在代码中直接使用。 If you need to make a column read-only, set the GridColumn.OptionsColumn.ReadOnly property to true instead. 如果需要将列设置为只读,则将GridColumn.OptionsColumn.ReadOnly属性设置为true。

I would also recommend reading the Modify and Validate Cell Values help article for more information in this regard. 我还建议阅读“ 修改和验证单元格值”帮助文章,以获取有关这方面的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM