private void NotifyPropertyChanged(DataRefPropertyDescriptor propertyDescriptor) { if (PropertyChanged != null) { PropertyChanged(this, propertyDescriptor.PropertyChangedEventArgs); } }
private void SetValue(DataRefPropertyDescriptor propertyDescriptor, object value) { var data = Data; if (data != null) { propertyDescriptor.SetValue(data, value); NotifyPropertyChanged(propertyDescriptor); } }
static DataRefBase() { PropertyDescriptorCollection = new PropertyDescriptorCollection(null); var propertyDescriptorCollection = TypeDescriptor.GetProperties(typeof(T)); m_PropertyMap = new Dictionary <PropertyDescriptor, PropertyDescriptor>(propertyDescriptorCollection.Count); foreach (PropertyDescriptor propertyDescriptor in propertyDescriptorCollection) { var mappedPropertyDescriptor = new DataRefPropertyDescriptor(propertyDescriptor); m_PropertyMap.Add(propertyDescriptor, mappedPropertyDescriptor); PropertyDescriptorCollection.Add(mappedPropertyDescriptor); } // create an artificial read-only property for the referenced instance //var instancePropertyDescriptor = TypeDescriptor.CreateProperty(typeof(DataRefBase<T>), "__DATA__", typeof(T)); //var mappedInstancePropertyDescriptor = new InstancePropertyDescriptor(instancePropertyDescriptor); //m_PropertyMap.Add(instancePropertyDescriptor, mappedInstancePropertyDescriptor); //PropertyDescriptorCollection.Add(mappedInstancePropertyDescriptor); }