文件名称:模仿microsoft实现依赖属性
文件大小:232KB
文件格式:RAR
更新时间:2017-03-05 13:30:29
依赖属性
//传入ownerType增加Owner public DependencyProperty AddOwner(Type ownerType) { return AddOwner (ownerType, null); } //增加所有者,根据ownerType和typeMetadata public DependencyProperty AddOwner(Type ownerType, PropertyMetadata typeMetadata) { if (typeMetadata == null) typeMetadata = new PropertyMetadata (); OverrideMetadata (ownerType, typeMetadata); // MS seems to always return the same DependencyProperty return this; } //获取元数据,依据forType public PropertyMetadata GetMetadata(Type forType) { if (metadataByType.ContainsKey (forType)) return metadataByType[forType]; return null; } //获取元数据,依据该依赖属性 public PropertyMetadata GetMetadata(DependencyObject d) { if (metadataByType.ContainsKey (d.GetType())) return metadataByType[d.GetType()]; return null; }
【文件预览】:
DependencySystem
----DependencySystem.sln(1KB)
----DependencySystem()
--------DependencySystem.csproj(3KB)
--------PropertyMetadata.cs(5KB)
--------Program.cs(2KB)
--------DependencyPropertyKey.cs(1KB)
--------DependencyPropertyChangedEventArgs.cs(2KB)
--------Properties()
--------DependencyObject.cs(5KB)
--------LocalValueEnumerator.cs(3KB)
--------DependencyObjectType.cs(3KB)
--------ClassDiagram1.cd(4KB)
--------obj()
--------DependencyProperty.cs(8KB)
--------bin()
----TDDDependencyTest()
--------PropertyMetadataTest.cs(8KB)
--------DependencyPropertyTest.cs(5KB)
--------TDDDependencyTest.csproj.user(311B)
--------Properties()
--------DependencyObjectTest.cs(4KB)
--------TDDDependencyTest.csproj(3KB)
--------obj()
--------bin()
--------DependencyObjectTypeTest.cs(2KB)
----DependencySystem.suo(44KB)