These are chat archives for JohanLarsson/Gu.Wpf.PropertyGrid

10th
Jul 2016
Johan Larsson
@JohanLarsson
Jul 10 2016 12:07
@zersiax would you be interested in testing accessibility for a small lib?
It is not quite ready for release yet though.
Johan Larsson
@JohanLarsson
Jul 10 2016 13:35
I have a tricky problem to solve:
When binding in templates UpdateSourceTrigger = PropertyChanged makes most sense as it enables binding the row with LostFocus or PropertyChanged
The tricky part is rolling back the Value in case of a validation error.
fetching the bindingexpression and calling UpdateTarget() will not work as it would reset the inputbox and no longer show the error.
Need to do a soft reset using SetCurrentValue()
Probably no easy way to get the value without reflection.
The value has to pass the binding pipeline with converters etc.
Gonna think about this for a while.
Johan Larsson
@JohanLarsson
Jul 10 2016 14:01
One way could be to create a private ValueProxy property and clone the binding and bind it to the same as Value
I don't love the idea due to the cloning, will be messy for multibindings etc.
Would be nice if there was a way to tell the source of a value in a dp
If it came from source or target, that would make it trivial.
worth downvotes if someone knows a nice way :)
Johan Larsson
@JohanLarsson
Jul 10 2016 16:27
Have an idea for what can be a somewhat nice solution now, gonna prototype it.
1) Flag IsResetting = true
2) bindingExpression.UpdateTarget()
3) In coerce check IsResetting and set current value if true
4) IsResetting = false
Johan Larsson
@JohanLarsson
Jul 10 2016 16:40
Will require some infrastructure around raising validation events but most is ready here I think
Relying on setting NotifyOnValidationError when binding in the template would be huge pit of failure.
Johan Larsson
@JohanLarsson
Jul 10 2016 16:45
the reset strategy will not be perfect either, only working when the control is bound