DEV GridControl/TreeList 中ShowingEditor使用

ShowingEditor事件对我来说就是控制单元格的编辑属性,在特定场景中(TreeList中要求子节点某些列可编辑,父节点不可编辑)就需要使用此事件来实现,与此同时,上一篇也介绍了特定场景单元格样式改变:CustomDrawCell

举个ShowingEitor的使用,

private void treeList1_ShowingEditor(object sender, System.ComponentModel.CancelEventArgs e)
        {
            TreeList currentTreeList = sender as TreeList;
            T row = treeList1.GetDataRecordByNode(currentTreeList.FocusedNode) as T;
            if (currentTreeList != null && row !=null )
            { 
                TreeListColumn column = currentTreeList.FocusedColumn;
                if (column.FieldName == "Qty" || column.FieldName == "Price" || column.FieldName == "Content" || column.FieldName == "Remark" || column.FieldName == "Amount")
                {
                    e.Cancel = (条件)?true:false;
                }
            }
        }

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页