Blog MVVM in C#: What Changes When You Switch UI Frameworks?
https://www.qt.io/blog/mvvm-csharp-when-you-switch-ui-frameworksHello, Miguel from Qt (qt.io) here. Following the release of the Qt Bridge for C#, I'd now like to share with you our latest blog post addressing some of the questions that we've since been asked.
"If I change UI frameworks, will the C# MVVM backend of my application still work?" This is the most frequent question that we've received from developers since releasing the Qt Bridge for C#. We wanted to provide some detailed information to back the answer to that question, which is: yes, when moving to a Qt Quick / QML UI, your C# MVVM backend will still work in the exact same way.
57
Upvotes
7
u/Dunge 2d ago
I'm aware this post is a vendor specific advertisement for Qt. But let me answer the question in a more general way from personal experience. I had a MVVM WPF app using reactiveui for most of the viewmodel logic. Wanted to port it to Blazor and re-use the viewmodels. Will be easy right, just have to create a few .razor html pages and pass the proper variables?
Well no, it took a whole year. Blazor isn't built with the propertychanged/observablecollection concept in mind, and refreshing views with StateHasChanged() is very different. Problems like too many refresh that need batch updates. Then comes the fact that most components, might it be a treeview, a datagrid, or a map control all have their own nitpicks depending on UI library and can't just be re-used the same way. Event handlers routing not having the same parameters. And more issues.
5
u/wubalubadubdub55 2d ago
This is great!