Surance Center

声明复杂属性--1

判断某个属性是否复杂属性:
1.该属性封装的数据类型是否是 非数值类型 ,即除String之外的引用类型或者集合类型
2.所要声明的属性格式.包括以下三种
   连字符形式  内部嵌套形式  内部嵌套形式默认属性

注意实现以下2个要点
1.设计时特性实现:包括 DesignerSerializationVisiblity  NotifyParentProperty  TypeConverter  ParseChildren PersistenceMode

2.属性中给定类型 与 String类型(或其他类型)的转换.
[TypeConverter(typeof(ExpandableObjectConverter))]//告诉浏览器提供折叠扩展功能
    public class LocationInfo
    
{
        [NotifyParentProperty(
true)]
        
public UInt32 X
        
{
            
get return 0; }
        }


        [NotifyParentProperty(
true)]
        
public UInt32 Y
        
{
            
get return 0; }
        }

    }
 [DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
        NotifyParentProperty(
true)
        ]
        
public LocationInfo Location
        
{
            
get return new LocationInfo(); }
        }
posted @ 2007-06-04 21:30  xxp  阅读(200)  评论(0编辑  收藏  举报
Surance Center