MVVM approach advice needed

damien darhk 21 Reputation points
2021-09-28T11:55:43.82+00:00

Hello,
I'm a beginner in MVVM, and WPF. My boss asked me to port a winform application in WPF; Basically it have an interface with docked windows (like VS), where each window display some data( loaded from a file) in different way: simple chart, tables, 3d chart, raw data ecc(should be 6 window); this are also interactive, I mean the user can change some value and save the file update for other uses.
I'd like to use mvvm pattern (and caliburn micro framework, or other) to do the task.
My problem is that I'm not sure to have correctly understand how to approach an application like this in MVVM.
For my understanding, I need to use for docking something like avalondock(that support mvvm), and create a View(as usercontrol in VS) and a ViewModel for each dockend"window" plus one as container, and a Model that actually contains the file as an array/stream.
I'm also unsure where handle the "interactivity"(basically the mouse change chart value by mouse), because I founded different answers googleing.
I can add more details if needed . Any advice?

Developer technologies | Windows Presentation Foundation
Developer technologies | C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 60,326 Reputation points
    2021-09-28T14:56:55.05+00:00

    MVVM is a huge topic. Personally I think it is far too much to discuss in these forums. There are many, many articles online on how to do it but the best option to me is to read through the documentation and tutorials for the framework you have decided to use. You mention Caliburn so I'd start with their tutorials and documentation. Walk through one of the samples and build it yourself. This will give you an idea of how the framework works, what parts you need and hopefully a solid example from which to base your own application.

    After that I'd look to blogs of folks who have tried to use the framework to write more interesting apps, such as:

    https://www.cshandler.com/2013/03/basics-of-caliburn-micro-with-simple.html#.YVMskTHMKHs
    https://softwareengineering.stackexchange.com/questions/287322/how-to-choose-not-to-use-a-framework-caliburn-micro-etc-in-a-given-mvvm-appl

    Bear in mind that this is an art more than science so just because you follow MVVM (or whatever pattern) doesn't mean you have to use it everywhere. In some cases you might find a more direct route might work better either temporarily or long term. It is your app so build it the way it makes the most sense even if it "violates" some arbitrary design pattern rule.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.