AcUtils
A high performance abstraction layer for AccuRev
SubPropertyDescriptor.cs
Go to the documentation of this file.
1 
16 using System;
17 using System.ComponentModel;
18 
19 namespace AcUtils
20 {
24  public class SubPropertyDescriptor : PropertyDescriptor
25  {
26  private PropertyDescriptor _subPD;
27  private PropertyDescriptor _parentPD;
28 
29  public SubPropertyDescriptor(PropertyDescriptor parentPD, PropertyDescriptor subPD, string pdname)
30  : base(pdname,null)
31  {
32  _subPD = subPD;
33  _parentPD = parentPD;
34  }
35 
36  public override bool IsReadOnly { get { return false; } }
37  public override void ResetValue(object component) { }
38  public override bool CanResetValue(object component) { return false; }
39  public override bool ShouldSerializeValue(object component) { return true; }
40 
41  public override Type ComponentType
42  {
43  get { return _parentPD.ComponentType; }
44  }
45 
46  public override Type PropertyType { get { return _subPD.PropertyType; } }
47 
48  public override object GetValue(object component)
49  {
50  return _subPD.GetValue(_parentPD.GetValue(component));
51  }
52 
53  public override void SetValue(object component, object value)
54  {
55  _subPD.SetValue(_parentPD.GetValue(component), value);
56  OnValueChanged(component, EventArgs.Empty);
57  }
58  }
59 }
Support TypeDescriptionProvider attribute on AcUser.