Quantcast
Channel: simplemvvmtoolkit Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 20

Commented Unassigned: ViewModelDetailBase IsValid binding update [1616]

$
0
0
Hey,


I noticed if i bind my button to the IsValid property of a ViewModelDetailBase (SimpleMvvmToolkit-SL5) it doesn't get updated when there is a validation error.
I think the problem is in the setter of the Model in that class.

The code:
```
if (notifyDataErrorInfo != null)
notifyDataErrorInfo.ErrorsChanged += (EventHandler<DataErrorsChangedEventArgs>) ((s, ea) =>
{
if (!this.ModelMetaProperties.Contains(ea.PropertyName))
return;
BindingHelper.InternalNotifyPropertyChanged("IsValid", (object) this, this.propertyChangedField, this.Dispatcher);
});
```

Description of ModelMetaProperties:
> Model meta-properties which should be ignored when handling property changed events,
and when dirty-checking or performing validation.

While debugging i notice that ea.PropertyName is the name of the property that has a error.
That name will normaly not be in the ModelMetaProperties list.
Resulting that BeginHelper wont get called.
If i compair it with the code in ViewModelDetailBaseCore i see that it is implemented correct there.
So i think you should remove the ! operator in if (!this.ModelMetaProperties.Contains(ea.PropertyName)).


Greetings
Skoucail
Comments: The code i linked was from the .dll. This is the code like its posted on codeplex: In ViewModelDetailBase (for SL5): ``` if (ModelMetaProperties.Contains(ea.PropertyName)) { BindingHelper.InternalNotifyPropertyChanged ("IsValid", this, propertyChangedField, Dispatcher); } ``` In ViewModelDetailBaseCore (common) ``` if (!_modelMetaProperties.Contains(ea.PropertyName)) { BindingHelper.InternalNotifyPropertyChanged ("IsDirty", this, propertyChangedField, Dispatcher); } ``` As you can see, i think you forgot the ! operator in ViewModelDetailBase (for SL5).

Viewing all articles
Browse latest Browse all 20

Trending Articles