Replies: 1 comment
-
/cc @grokys any thoughts about this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Current
in
void SetValue(object?, Exception?)
ofExpressionNode.cs
there is a reference check of binding value:Avalonia/src/Avalonia.Base/Data/Core/ExpressionNodes/ExpressionNode.cs
Line 238 in 42aa77e
which makes some differences between
Avalonia
andWPF
.In
WPF
, whoever trigger thePropertyChanged
will unconditionally update the related view butAvalonia
will check the ref of two values and reject update if they are equal.I know in some case this check can reduce repeated execution, but what my code run worse just the opposite.
Here is my scene:
My lib Antelcat.I18N, supports both
WPF
&Avalonia
, provides language bindings using user code bindings. Most of them areMultiBinding
s which contains multiple keys of language source. In this case, update each key alone will trigger the calc many times, but 'language update' is always a 'group update' so I design anotifier
which will trigger 'PropertyChanged' only one time when language update complete. It appears at the first place ofBindings
in all theMultiBinding
s and whose path is always points to the language source so I can get the source directly fromvalues[0]
inIMultiValueConverter
.But somehow it doesn't work, even if I trigger
PropertyChanged
,Avalonia
reject to update cause it found ref not actually changed.I know there is some ways that can avoid this problem such as making notfier something else. But this make it to be more internal references and more codes just to fit this situation. I think the user code should be responsible for the handling of reference changes while framework code just need to focus on execution.
It's like you write code to prevent this from working and I write extra code to make it work.
Beta Was this translation helpful? Give feedback.
All reactions