Closed lanyusan closed 1 year ago
Hey @lanyusan
I think this ReactiveUI bindings don't work in Avalonia. If I make an Avalonia-binding it works for me, see https://docs.avaloniaui.net/docs/data-binding/binding-from-code#using-xaml-bindings-from-code for docs about it.
I send you a PR, so you can try it on your own: https://github.com/lanyusan/avalonia-bug-1/pull/1
Happy coding Tim
@timunie
Thanks. It works but it is pretty clumsy.
I would suggest the TEAM to fix the problem of binding by name specified in xamal or make it clear in documentation that it has to use this.FindControl
to locate control.
Personally I would much appreciate a fix as it makes much more senses.
this.FindControl
is needed because the mame was not resolved in the constructor. I agree that this maybe is a bug with the names generator. The other thing is the binding, which is not supported the way you did it I guess. I'm not sure if that will ever work tbh.
Describe the bug When run reactiveui sample that bind control to model in
this.WhenActivated(disposables => {
, below error reported.If bind in axmal
Text="{Binding Greeting}
, it works fineTo Reproduce
Clone this repo:
https://github.com/lanyusan/avalonia-bug-1
run:
dotnet run
Expected behavior
Program launched successfully.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information): Linux Ubuntun 22.04