示例#1
0
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            ElementPropertyDescriptor propertyDescriptor = context.PropertyDescriptor as ElementPropertyDescriptor;

            if (propertyDescriptor != null)
            {
                ArrayList list        = null;
                string    actualValue = value as string;

                if (!string.IsNullOrEmpty(actualValue))
                {
                    list = ModelProperty.DeserializeValidatorList(actualValue);
                }

                PropertyValidationEditorForm editor = new PropertyValidationEditorForm(list);
                if (editor.ShowDialog() == DialogResult.OK)
                {
                    if (editor.Value != null)
                    {
                        value = ModelProperty.SerializeValidatorList(editor.Value);
                    }
                    else
                    {
                        value = null;
                    }
                }
            }

            return(value);
        }
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            ElementPropertyDescriptor propertyDescriptor = context.PropertyDescriptor as ElementPropertyDescriptor;
            if (propertyDescriptor != null)
            {
                ArrayList list = null;
                string actualValue = value as string;

                if (!string.IsNullOrEmpty(actualValue))
                    list = ModelProperty.DeserializeValidatorList(actualValue);

                PropertyValidationEditorForm editor = new PropertyValidationEditorForm(list);
                if (editor.ShowDialog() == DialogResult.OK)
                {
                    if (editor.Value != null)
                        value = ModelProperty.SerializeValidatorList(editor.Value);
                    else
                        value = null;
                }
            }

            return value;
        }