fbpx
Welcome, Guest
Username: Password: Remember me
Share your code snippets, screen shots etc. here
  • Page:
  • 1

TOPIC: MVVM: how couple View and ViewModel together and open a view from a ViewModel

MVVM: how couple View and ViewModel together and open a view from a ViewModel 2 years 6 months ago #974

  wriedmann's Avatar Topic Author wriedmann Offline Posts: 1631
Based on what Nick Friend wrote about the coupling of View and ViewModel, I have tried to build a ViewFactory class.

It is very simple to use:

Initialize the coupling one:
ViewFactory.AddCouple( TypeOf( ViewModel2 ), TypeOf( View2 ) )

and then open it from the ViewModel:
ViewFactory.CreateView( typeOf( ViewModel2 ) )

Please find attached the complete sample as XIDE export file.

As I wrote before, my work is a work in progress and far from being finished - I only try to write understandable and working code, so you will not find any dependency on some MVVM frameworks.

Of course, I'm always open to suggestions or corrections.

Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it
Attachments:

Please Log in or Create an account to join the conversation.

  • Page:
  • 1