Beispiel #1
0
        public DictionaryEditControl()
        {
            InitializeComponent();
            var commonEditController = new CommonObjectEditController();

            commonEditController.StartEditObject(null);
            this.ColumnObject.ColumnEdit = commonEditController.CreateRepositoryItem();
        }
        private void PropertyGridControl_CustomRecordCellEdit(object sender, DevExpress.XtraVerticalGrid.Events.GetCustomRowCellEditEventArgs e)
        {
            RepositoryItem repositoryItem = null;
            var            propDesc       = PropertyGridControl.GetPropertyDescriptor(e.Row);

            if (propDesc == null)
            {
                return;
            }
            var controller = Controller as ObjectPropertyEditController;

            if (controller != null)
            {
                var editController = controller.GetPredefinedEditController(propDesc.PropertyType, propDesc.Name);
                if (editController != null)
                {
                    repositoryItem = editController.CreateRepositoryItem(propDesc.PropertyType);
                }
            }

            if (repositoryItem == null)
            {
                if (propDesc.PropertyType.IsAddon())
                {
                    // 如果是插件,统一使用CommonObjectEditControl,这样可以新增空对象
                    var editController = new CommonObjectEditController();
                    editController.StartEditProperty(EditValue, propDesc.Name);
                    repositoryItem = editController.CreateRepositoryItem(propDesc.PropertyType);
                }
                else
                {
                    repositoryItem = EditorPublic.CreateRepositoryItem(propDesc);
                }
            }

            if (repositoryItem != null)
            {
                e.RepositoryItem = repositoryItem;
            }
        }