コード例 #1
0
 private void NotifyPropertyChanged(DataRefPropertyDescriptor propertyDescriptor)
 {
     if (PropertyChanged != null)
     {
         PropertyChanged(this, propertyDescriptor.PropertyChangedEventArgs);
     }
 }
コード例 #2
0
        private void SetValue(DataRefPropertyDescriptor propertyDescriptor, object value)
        {
            var data = Data;

            if (data != null)
            {
                propertyDescriptor.SetValue(data, value);
                NotifyPropertyChanged(propertyDescriptor);
            }
        }
コード例 #3
0
        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);
        }