【发布时间】:2014-01-13 11:33:17
【问题描述】:
我正在 wpf 中创建我的第一个 mvvm 应用程序,我需要将文件拖放到 ListBox 中,我看不到任何其他方法,但使用 DragEnter 和 Drop 事件,然后通过将视图的 DataContext 转换为我的 ViewModel 并从那里访问集合,将删除的文件添加到我的集合中,这真的很棒。
drop 事件中我的视图中的类似内容
(this.DataContext as ImageViewModel).ToUpload.Add(new ImageModel() { localfilelocation = fi.FullName })
但是还有其他方法吗?
【问题讨论】: