Replies: 4 comments 5 replies
-
|
I suggest using this would be better: https://github.com/AvaloniaUtils/DialogHost.Avalonia/ |
Beta Was this translation helpful? Give feedback.
-
|
The Music Store tutorial does explain it, albeit not in a straightforward way as most things in ReactiveUI are not straightforwards. The simplified tl;dr for it is:
The result is your interaction makes a full round trip from your viewmodel, to your view and back to your view model. If it helps you can think of Interactions as possibly blocking events that allow for data to go two ways (EG from the view model to the view and back). This decouples your view model from your presentation logic, as your view model only cares about the result of the dialogue. Your view model can also just sit there and wait for a result to get back from the interaction. But for most simple dialogues you probably don't want to block. In which case your view would just instantly handle the interaction, show the dialogue and return some default value (likely If you need a more detailed example, let me know. It took me awhile to get my head around it too. I personally would be in favour of the tutorial being expanded upon since it skips/badly explains lot of stuff like this. That said, interactions are not the only way to display dialogues. There are many others. Some follow the MVVM pattern better than others. |
Beta Was this translation helpful? Give feedback.
-
|
I'm using a combination of In the ViewModelBase.cs you can replace
and then call the dialog choosing which DialogWindow to use, eg There are lots of ways of achieving this hence lots of examples. I found these libraries easier to grasp as I've used similar with WPF in the past. I had some recent help from the Prism.Avalonia community on how to implement custom DialogWindow, see this discussion link for more help AvaloniaCommunity/Prism.Avalonia#94 |
Beta Was this translation helpful? Give feedback.
-
|
Sorry to hijack this post, but I feel like I face the same challenge. Not a real programmer, just doing it as a kind hobby and struggling with opening a new view. Sorry for the confusion, but I am confused as he** |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
I've been trying to open viewmodels from usercontrols but I've not any articles or documentation that simplifies the process for a newbie.
I am using MVVM Community Toolkit and most of the implementations are simply too sophisticated. Is there a step-wise procedure or explanation on how to go about understanding this? The Music Store tutorial simply doesn't cut it, as it has little to no explanation on how new windows are handled.
Beta Was this translation helpful? Give feedback.
All reactions