以下拉列表为例:
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就变为下拉选择的形式了