MVVM Light & WPF - Binding Multiple instances of a Window to a ViewModel

前端 未结 2 2118
猫巷女王i
猫巷女王i 2020-11-27 19:38

I am working on my first project in MVVM and I\'ve chosen to use the MVVM Light Toolkit. I have a GameViewModel that handles business on the main screen of my g

2条回答
  •  迷失自我
    2020-11-27 20:43

    Follow up to Viv, I modified the sample to include an example of opening the window without using a code behind.

    Sample project is here.

    I'm utilizing the ViewModelLocator singleton with a static method that news up the viewmodel and window and Data Context instead of the code behind.

    Blog Post with Details. Let me know which method is preferable. I dislike using code behind, but there could be pro's and con's I'm missing.

提交回复
热议问题