-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkboxes erroneously shown as failing validation #78
Comments
Ooh, nice! Yes, that makes sense. |
Thanks for responding so quickly! |
You say that this also resolves
But wasn't the point of that issue that it only applied to |
I'm not sure why I thought it only fixed it when UpdateSourceTrigger is set to PropertyChanged. I've just tested it again, and (unless I'm misunderstanding what the expected behavior is) it behaves sensibly regardless of what it's set to. |
Yes, you're right, I tested and it's fixed. Three for one - thanks again! |
Description
Using the latest version (2.0.0-beta-9) of Elmish.WPF, if you bind to a
DataGridCheckBoxColumn
in aDataGrid
, then changing its value results in an error being displayed by the validation template:Repro steps
Create a
DataGridCheckBoxColumn
whoseBinding
is set to a 2-way Elmish.WPF binding.Click to change the value of the
CheckBox
An example script can be found in the repository BillHally/Elmish.WPF.DataGridCheckBoxColumnIssue.
Expected behavior
CheckBox is displayed without incorrectly indicating that validation has failed.
Actual behavior
CheckBox is displayed incorrectly indicating that validation has failed.
Known workarounds
You could probably set a custom validation template that ignores errors (I've not tried).
Related information
This is caused by ViewModel.TrySetValue returning
false
. The reason it does so seems to be to avoid an updating issue.However, I've performed some tests with the script I linked to above, and it seems that this issue was fixed by the addition of this changeset "adding UI thread synchronization option for .NET" to Elmish.
Consequently, I think that
TrySetValue
should be changed to return true when passed a binder whose name it recognises.Making this change would resolve:
UpdateSourceTrigger
is set toPropertyChanged
)I'll send a pull request for the relevant changes.
The text was updated successfully, but these errors were encountered: