The best approach to create new window in WPF using MVVM

后端 未结 6 1904
無奈伤痛
無奈伤痛 2020-12-04 07:21

In the neighbour post: How should the ViewModel close the form? I\'ve posted my vision how to close windows with MVVM usage. And now I have a question: how to open them.

6条回答
  •  没有蜡笔的小新
    2020-12-04 07:54

    Take a look at my current MVVM solution for showing Modal Dialogs in Silverlight. It solves most of the issues you mentioned yet its completely abstracted from platform specific things and can be reused. Also i used no code-behind only binding with DelegateCommands that implement ICommand. Dialog is basically a View - a separate control that has its own ViewModel and it is shown from the ViewModel of the main screen but triggered from the UI via DelagateCommand binding.

    See full Silverlight 4 solution here Modal dialogs with MVVM and Silverlight 4

提交回复
热议问题