public PropertyValueBaseViewModel(IViewModelsFactory<IPickAssetViewModel> vmFactory, PropertyAndPropertyValueBase item, string locale) { InnerItem = item; _vmFactory = vmFactory; _locale = locale; if (InnerItem.IsEnum) { if (InnerItem.IsMultiValue) { foreach (var value in InnerItem.Values) { var propertyValue = InnerItem.Property.PropertyValues.FirstOrDefault(x => x.PropertyValueId == value.KeyValue); if (propertyValue != null) { value.BooleanValue = propertyValue.BooleanValue; value.DateTimeValue = propertyValue.DateTimeValue; value.DecimalValue = propertyValue.DecimalValue; value.IntegerValue = propertyValue.IntegerValue; value.LongTextValue = propertyValue.LongTextValue; value.ShortTextValue = propertyValue.ShortTextValue; value.KeyValue = propertyValue.PropertyValueId; } } } var defaultView = CollectionViewSource.GetDefaultView(InnerItem.Property.PropertyValues); defaultView.Filter = FilterPropertyValues; } SetVisibility(); AssetPickCommand = new DelegateCommand(RaiseAssetPickInteractionRequest); AssetRemoveCommand = new DelegateCommand(RaiseAssetRemoveInteractionRequest); CommonConfirmRequest = new InteractionRequest<Confirmation>(); }
public PropertyValueBaseViewModel(IViewModelsFactory<IPickAssetViewModel> vmFactory, PropertyAndPropertyValueBase item) { InnerItem = item; _vmFactory = vmFactory; if (InnerItem.IsMultiValue) { var defaultView = CollectionViewSource.GetDefaultView(InnerItem.Property.PropertyValues); defaultView.Filter = FilterPropertyValues; } SetVisibility(); AssetPickCommand = new DelegateCommand(RaiseAssetPickInteractionRequest); AssetRemoveCommand = new DelegateCommand(RaiseAssetRemoveInteractionRequest); CommonConfirmRequest = new InteractionRequest<Confirmation>(); }