WinForms and MVVM

Thinking Out Loud
27 November 2015

Our WinForms team recently told me that we should do a better job telling the world about our MVVM Framework for WinForms developers. Seems the news hasn't spread fast enough. :)

Reddit | https://www.reddit.com/r/csharp/comments/3u6pp5/modern_winforms_design_whats_your_goto_desigb/

Stack Overflow | http://stackoverflow.com/questions/595469/ui-design-pattern-for-windows-forms-like-mvvm-for-wpf

If you've not yet seen or used our MVVM Framework, please refer to the following blog post from June, 2015.

DevExpress WinForms and MVVM Blog Post  

I'd be curious to hear your thoughts on MVVM and WinForms. How many of you prefer it over traditional WinForms methodologies?

8 comment(s)
Neven
Neven

MVVM looks great but I personally need more real life examples how to use it. For example, provide us with simple app that uses XPO and MVVM framework.

28 November, 2015
Steve Sharkey
Steve Sharkey

Only just making headway with XAF (having had it for many years) as the documentation is not quite as comprenehsive as I'd like so whilst I might like (post XAF app) to give this a go I think the documentation has some way to go before I could reasonably expect to make progress with it.

If I was just toying around with software development (like in my early years) I might be keener but these days it's a means to an end and building stuff that pays the bills is my primary focus: if it takes longer to get over the learning hump than the time it'll save me in the (relatively) short term, I can't justify the time.

30 November, 2015
Petr Vojtechovsky 1
Petr Vojtechovsky 1

Dear Devexpress

I think the problem is the developers do not jump on pre-mature frameework. There are numbers of patterns and frameworks around and now we have another one from devexpress :)

 About one or two years ago devexpress introduced MVVM pattern for WPF and as a bridge to winforms there was, I guess,  another pattern MVPVM

I have tried and found it over-complicated. What was my biggest "no GO":

1) my logic was not easily transferable to another platform. If i do all app in winforms I want to be able to take my "controller"(or viewModel, or Presenter, or whatever) and do WPF or universal App.

2) complexity, Model, View, ViewModel, Presenter ...

3) it looked more like a poc project rather than a serious product

4) I saw Dashboard winforms presentation. I took the source-code from github -> it did not even compile

5) community starter - u get help only from your support. Other developers 99% are still using event handles :)

6) other more popular alternatives for winforms

7) not sure where is the framework now. It used to be called "MVPVM for winforms". Now you can see anly some fractions in code examples: www.devexpress.com/.../T127068.aspx

I have looked at prism. Unfortunately, it is WPF only or WINFORM are not supported. Recently MS dropped the whole project now it is purely community driven.  Brian Lagunas(your competitor) is one of lead developers.

My second choice was ReactiveUI by Paul Betts. This frameworks is so far my preferable solution. It gives more or less what i needed. It promises to run the same code on multi-platforms and it uses internally reactive extensions. It implements MVVM pattern.

Best Regards

Petr

30 November, 2015
Nikita (DevExpress Support)
Nikita (DevExpress Support)

Hello guys,

@Neven

We are aware that our users often request examples with our MVVM framework and XPO. We are currently working on them and planning to release them soon.

@Steve

I agree that quick start is important to users of our framework. That is why the upcoming 15.2 release contains a fully functional scaffolding engine. Using scaffolding, you can generate a working application just after connecting a database and understanding of the subtleties of the framework is not required. You can find them when you are tuning the generated code. It would be fine if you find time to test this functionality.

@Petr

Thank you for your detailed comment. Let me also add some details :)

It is difficult to build a big application without using a framework. Of course, it is important to select an appropriate tool for your application. We understand that there are alternative solutions that can be similar or not similar to our framework. And also, we understand that a new framework can cause some sort of distrust.

The main purpose of creating our MVVM framework is to allow programmers who are using DevExpress controls to easily get a workable solution without adapting them to a new  framework or pattern. Most of adaptation is performed on our side, and we are ready to further develop this area.

And now, here are some comments on your "No GO" items:

1. Usually, the same codebase (a Data model\View model) can be used for different platforms without changes. We have examples that work this way.

3. Would you please provide the GitHub link where you found this broken project, so that we can fix it?

6. I agree with you, there are more popular alternatives. However, most of community maintained frameworks do not guarantee user support, while with our framework, you can get support both for controls and the framework

In addition, I would like to describe the situation with MVPVM for WinForms examples and our documentation. "P" in MVPVM is a consequence of using the WinForms platform. In a common case, a WinForms developer should write the Presenter layer. Our framework allows you to avoid using the presenter layer. So if you are using Bindings and Commands, you can get rid of this layer as well as of letter "P" in the pattern name. We have described these points in detail at documentation.devexpress.com.  In this article, you can also find the main concepts, instructions on how to work with these features at design time and tutorial links. We are constantly working on this section and updating it.

1 December, 2015
Theodore p
Theodore p

One thing that i agree with Petr is that developers cannot trust premature frameworks in real-life applications. We adopted MVPVM in a new project and in the next release you introduced the MVVMContext, which actually is great, but we had to make lots of modifications to adapt to this new component. So this is one reason why sometimes we prefer not to "touch" new frameworks until the are more complete and with proper documentation.

Having said that, i want to add that since MVVMContext was introduced we use it almost everywhere but not for every task. Basic binding, triggers and event handlers are extremely helpful, but other features like services are not so clear to understand and use. Also it took us some time to become "fluent" with it and we find it more helpful to configure everything in code rather in the designer.

Another issue i would like to raise is that command binding is not compatible with every control. One case is Flyout commands, for which i have created a support ticket and still waiting for it to be implemented. WindowsUIButtons is another case. So here and there we still have to write our own handles which beats the case of MVVM. So if there is one thing that i would like to ask is more integration with winforms controls.

Nevertheless, you have done great job as usual and i am looking forward to new features!

2 December, 2015
Maciej Kłusowski 1
Maciej Kłusowski 1

I'm using DevExpress Forms components with the MVVMLight framework (BindCommand is sufficient for ViewModel commands binding). It seems to me that the DevExpress MVVM Framework for WinForms should be cross-platform (PCL, Xamarin friendly) to get more interest.

5 December, 2015
Petr Vojtechovsky 1
Petr Vojtechovsky 1

Hi Nikita

@3: there is a very interesting video from Seth "Creating an Outlook

Inspired UI" - www.youtube.com/watch

and here you go the github repo: github.com/.../DevAV

@6: sure, there are other frameworks and they do a very good job. The biggest challenge( as always) is to convince developers to use the new framework.

IMHO, it is VERY, VERY difficult to succeed without solid foundations and clear arguments WHY the new framework is better then the others. Compare them, explain the whole concept why we need another framework, prove it that you offer the best on the market.

For winforms it should not be that difficult since the competitors are almost none.

FOR WPF...outch...you go against  MVVM Light, Caliburn, Prism, ReactiveUI. it is a challenge!!!

There are always questions the developers will ask:

-What happens if you change your mind and stop supporting the new framework?

- Can I go on with my projects?

- Do I have resources to change the project to another framework?

- could I contribute to the framework?

- is the framework open-sourced, will it be free forever?

I see there is something from devexpress on github but the activity seems to be very low:

github.com/.../DevExpress.Mvvm.Free

I wish you best luck and thank you for the excellent components you are working on

Petr

9 December, 2015
Nikita (DevExpress Support)
Nikita (DevExpress Support)

Hello guys,

@Theodore p

Thank you for your feedback.  Our WindowsUIButtons already support command binding. As for document action commands, we have just implemented them. This functionality will be available in the next minor version. Here is a ticket with additonal information and a code sample: isc.devexpress.com/.../T243942

@Maciej Kłusowski 1

While views are platform-dependent, our ViewModels are cross-platform and applicable to multiple platforms.

@Petr Vojtechovsky 1

Thank you for your answer. This GitHub link refers to a proof of concept for version 14.1. Currently, we include the latest version of MVVM framework into our .NET installer. As the integration functionality with our controls is implemented in this full version, I suggest you use it. You can find the free version on GitHub:

github.com/.../DevExpress.Mvvm.Free

As I mentioned before, by creating MVVM Framework, we aimed to adapt our controls to the MVVM pattern at our end.

We are going to further develop this framework for the foreseeable future, because now this is an integral part of our controls suite. For this reason we won’t deprecate this framework and will always maintain it.

Currently, we have a free version of our framework on GitHub and a version that comes with our .NET controls (this version has a special functionality to simplify the interaction of this framework with our controls). We have no immediate plans to change the licensing model for this framework.

You are welcome to contribute into the free version of the framework. If you need additional functionality in the paid version of the framework, feel free to create a ticket in our Support Center, and our developers will consider these improvements.

21 December, 2015

Please login or register to post comments.