1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
5 namespace System.Activities.Presentation.Model
8 using System.Collections.Generic;
11 using System.ComponentModel;
12 using System.Activities.Presentation.Model;
14 class AttachedPropertyDescriptor : PropertyDescriptor
16 AttachedProperty AttachedProperty;
19 public AttachedPropertyDescriptor(AttachedProperty AttachedProperty, ModelItem owner)
20 : base(AttachedProperty.Name, null)
22 this.AttachedProperty = AttachedProperty;
26 public override AttributeCollection Attributes
30 List<Attribute> attributeList = new List<Attribute>();
31 foreach (Attribute attr in TypeDescriptor.GetAttributes(this.PropertyType))
33 attributeList.Add(attr);
35 BrowsableAttribute browsableAttribute = new BrowsableAttribute(this.IsBrowsable);
36 attributeList.Add(browsableAttribute);
37 return new AttributeCollection(attributeList.ToArray());
41 public override Type ComponentType
43 get { return this.owner.ItemType; }
46 public override bool IsReadOnly
50 return this.AttachedProperty.IsReadOnly;
54 public override Type PropertyType
58 return this.AttachedProperty.Type;
62 public override bool IsBrowsable
66 return this.AttachedProperty.IsBrowsable;
69 public override bool CanResetValue(object component)
74 public override object GetValue(object component)
77 return this.AttachedProperty.GetValue(owner);
80 public override void ResetValue(object component)
82 this.AttachedProperty.ResetValue(owner);
85 public override void SetValue(object component, object value)
87 this.AttachedProperty.SetValue(owner, value);
90 public override bool ShouldSerializeValue(object component)