Beispiel #1
0
 public PropertyValueModel(ITemplateProvider templateProvider, object parent, PropertyInfo propertyInfo, DataTemplateAttribute datatemplate = null)
 {
     _parent                = parent;
     _templateProvider      = templateProvider;
     _propertyInfo          = propertyInfo;
     _displayName           = propertyInfo.Name;
     _dataTemplateAttribute = _propertyInfo.GetCustomAttribute <DataTemplateAttribute>(true);
     if (parent is  INotifyPropertyChanged bindable)
     {
         bindable.PropertyChanged += Bindable_PropertyChanged;
     }
     if (_propertyInfo.PropertyType == typeof(Rect))
     {
         _rectangleWrapper = new RectangleWrapper((Rect)_propertyInfo.GetValue(_parent));
         _rectangleWrapper.PropertyChanged += Wrapper_PropertyChanged;
     }
     else if (_propertyInfo.PropertyType == typeof(FontWeight))
     {
         _valueNames = typeof(FontWeights).GetProperties(BindingFlags.Static | BindingFlags.Public).Select <PropertyInfo, string>((x) => x.Name).ToArray();
     }
     else if (_propertyInfo.PropertyType.IsEnum)
     {
         _valueNames = Enum.GetNames(_propertyInfo.PropertyType);
     }
 }
Beispiel #2
0
 public void Assign(RectangleWrapper wrapper)
 {
     _rectangle = wrapper._rectangle;
     //if (notify)
     //{
     //    RaisePropertyChanged("XValue");
     //    RaisePropertyChanged("YValue");
     //    RaisePropertyChanged("WidthValue");
     //    RaisePropertyChanged("HeightValue");
     //}
 }