Replies: 4 comments 6 replies
-
If you are new to Avalonia, I highly suggest to read the docs and explore our samples https://github.com/AvaloniaUI/Avalonia.Samples . Imo Avalonia works best if you use the MVVM pattern and use DataTemplates to define the controls layout. This is probably way different to how QT works. If you really want to use code only, check also https://github.com/AvaloniaUI/Avalonia.Markup.Declarative |
Beta Was this translation helpful? Give feedback.
-
To also add onto what Tim said, there is also this project simplify doing exactly this. But it's primarily made for F# devs. https://github.com/fsprojects/Avalonia.FuncUI It probably works with C# though (it all gets compiled to the same code, which is why it works with Avalonia at all) but documentation is probably harder to find. In any case, it's not something I have tried. That said: You can still load XAML files at runtime using the runtime loader. But parsing some other file will also work too if you feel like implementing a custom parser. Avalonia (like most other XAML frameworks) is also very flexible with control layouts. To the point you can override the look and functionality of pretty much any control or easily make your own that combines other built in controls. I think everything you want should be possible. Let me also preface this paragraph by saying I am not an expert at QT. But you might run into some problems if you are relying on things like inline QML scripts. As there is no direct equivalent in Avalonia or C#. You could implement your own though. There are plenty of .NET bindings for various scripting languages such as lua. You can also use C# itself as a scripting language too, but it still has various issues from my understanding. EG dotnet/roslyn#16897 |
Beta Was this translation helpful? Give feedback.
-
Thanks for the replies and links. I've skimmed through all of them and it all looks good so far. Regarding the Qt, I'm not using QML, just the classic widgets. The "problem" with XAML is that the UI files we're using is done in custom application, therefor we need to parse the file and the build the UI. Later we could make an utility to to convert the files to XAML directly. |
Beta Was this translation helpful? Give feedback.
-
I have another question though. From what I've read, dialogs (Windows.ShowDialog()) aren't supported in browser (only desktop app) AFAIK. So what are my options of emulating them? So far I've found https://github.com/AvaloniaUtils/DialogHost.Avalonia . Do there exists some other implementations? |
Beta Was this translation helpful? Give feedback.
-
We have client/server application, where our client is written using Qt and C++. I want to port the client to the Avalonia mainly because of WASM (the problem is little complex that that, we also have Wt plugin as web UI and we need to maintain multiple "UI"s so it would be better to have only one to maintain; and also Qt licensing).
In our client the whole UI is dynamically loaded from custom files, so no AXAML whatsoever only created from the code. We're using simple controls (text edit, combo box, radio, date control, ...) and more complex controls (Custom data view - DataGrid in Avalonia terms, custom combo box with data grid embedded, ...) and different dialogs (even nested). For communication with server we're using websocket (with custom ping handling).
From looking through the docs, articles etc. it sound possible but I would like to know if there could be some potential "blocker issue"?
Beta Was this translation helpful? Give feedback.
All reactions