WPF MVVM - Command binding inside of an ItemsControl

前端 未结 3 484
抹茶落季
抹茶落季 2021-02-03 12:00

I\'m currently converting a small WPF project to MVVM. I have a List in the ViewModel of the main window that my ItemsControl binds to and uses

3条回答
  •  遇见更好的自我
    2021-02-03 12:38

    Josh Smith wrote an excellent article in MSDN here where he talks about command binding.

    In your case it boils down to this:

    • You won't eliminate ALL of your code-behind, but it will probably look different
    • Your CustomObjects will probably have to have VM shim classes, or be VMs themselves to take advantage of the RelayCommand architecture that he describes.

    HTH.

提交回复
热议问题