WPF: How to attach mouse events to a viewmodel?

后端 未结 6 2064
南笙
南笙 2021-02-04 19:47

I am trying to use the MVVM pattern for the first time. So I have an ItemsControl filled with my viewmodel objects, displayed using DataTemplate\'s; th

6条回答
  •  Happy的楠姐
    2021-02-04 20:10

    Bea Stollnitz has a drag and drop example titled "How can I drag and drop items between data bound ItemsControls?". I'd post the link, but StackOverflow isn't letting me.

    You may want to split up the UI feedback while dragging is in process and the action performed when it is finally dropped.

    I would agree w/Thomas and Cameron above, however. You'll want to limit the mixing/matching of event handling and data binding. If you're going the event handling route, you may not want to avoid using the term "View Model" for your objects as it generally denotes the data binding alternative.

提交回复
热议问题