using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SWS.CAD.Views.CustomControl { /// /// 有一种情况 /// 1.自身属性绑定其他属性的控件的属性 /// 可对字段属性应用的 PropertyGrid 关联特征 /// 关联特征作用:可使用修饰的字段或者属性的值,和其他属性生成控件的值进行绑定 /// 多用于,属性编辑控件中勾选框,控制其他控件的显示(或者其他值),通过绑定实现 /// 作用范围枚举,inherited=是否继承,AllowMultiple=是否允许多次描述。 [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] public class RelationAttribute : Attribute { /// /// 1.同一控件需要关联的属性名称,使用英文逗号隔开 不同的写多个 RelationAttribute /// eg:Text,Size /// public string CrPropName; /// /// 1.控件属性名称关联的类属性名称,使用英文逗号隔开,与CrPropName想对应 /// eg:Name,Size /// public string ClPropName; /// /// 使用绑定显示隐藏的时候 CrPropName=VisibilityValue /// 必须设置该字段值,也就是控件显示的值 /// public object VisibilityValue; public string Tag; public RelationAttribute(string clPropName, string crPropName) { CrPropName = crPropName; ClPropName = clPropName; } } }