关闭

怎样修改自定义活动的属性编辑器

612人阅读 评论(0) 收藏 举报

以下拉列表为例:

public static DependencyProperty ExecuteModeProperty = System.Workflow.ComponentModel.DependencyProperty.Register("ExecuteMode", typeof(string), typeof(Class));
        [Description("")]
        [Category("")]
        [Browsable(true)]
        [TypeConverter(typeof(ExecuteModeItems))]
        [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
        public string ExecuteMode
        {
            get
            {
                return ((string)(base.GetValue(ChildWorkFlow.ExecuteModeProperty)));
            }
            set
            {
                base.SetValue(ChildWorkFlow.ExecuteModeProperty, value);
            }
        }

ExecuteModeltems.cs :

using System;
using System.Collections.Generic;
using System.Text;

using System.ComponentModel;
namespace REAP.Workflow.Activities
{
    internal class ExecuteModeItems : StringConverter
 {
        private static StandardValuesCollection defaultRelations =
             new StandardValuesCollection(
                new string[] { "可选内容", "可选内容" });
 
         public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
        {
            return true;
        }

        public override bool GetStandardValuesExclusive(
                       ITypeDescriptorContext context)
        {

            return false;
        }

        public override StandardValuesCollection GetStandardValues(
                      ITypeDescriptorContext context)
        {
            return defaultRelations;
        }
    }
}

这样属性ExecuteMode就变为下拉选择的形式了

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:6531次
    • 积分:112
    • 等级:
    • 排名:千里之外
    • 原创:5篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条
    文章分类
    文章存档