public static ModelPropertyBuilder <TOwner, TProperty> PropertyChanged <TOwner, TProperty>( this ModelPropertyBuilder <TOwner, TProperty> propertyBuilder, Action <PropertyChangedCallbackArgs <TOwner> > callback) { propertyBuilder.AddPropertyChanged(callback); return(propertyBuilder); }
public static ModelPropertyBuilder <TOwner, TProperty> Calculate <TOwner, TProperty>( this ModelPropertyBuilder <TOwner, TProperty> propertyBuilder, Func <TOwner, TProperty> calculator) { propertyBuilder.SetCalculator(calculator); return(propertyBuilder); }
internal static ModelProperty BuildUpProperty <TOwner, TProperty>(ModelPropertyBuilder <TOwner, TProperty> propertyBuilder) { var ownerType = typeof(TOwner); EnsureTypeDescriptionProviderCreated(ownerType); ModelProperty <TOwner> modelProperty; if (propertyBuilder.Calculator != null) { modelProperty = new CalculatedModelProperty <TOwner>(propertyBuilder.PropertyName, typeof(TProperty), o => propertyBuilder.Calculator((TOwner)o)); } else { modelProperty = new InstanceModelProperty <TOwner>(propertyBuilder.PropertyName, typeof(TProperty), false); } foreach (var callback in propertyBuilder.Callback) { modelProperty.AddPropertyChanged(callback); } typeDescriptionProviders[ownerType].AddProperty(modelProperty); return(modelProperty); }
public static ModelProperty Build <TOwner, TProperty>(this ModelPropertyBuilder <TOwner, TProperty> propertyBuilder) { return(ModelProperty.BuildUpProperty(propertyBuilder)); }