WPF ListBox 获取项目数据上下文 OnMouseOver
我当前有一个视图,其中包含一个绑定到视图模型集合的列表框和一个用户控件,我想将其绑定到鼠标悬停的当前项目。如何仅使用视图模型中的 XAML 和代码获取列表中当前突出显示的项目并将其绑定到用户控件?
编辑:下图可能更能描述预期的操作。 替代文本 http://img134.imageshack.us/img134/6263/34548010.png< /a>
I currently have a view that contains a ListBox bound to a a collection of view models and a user control that I would like to bind to the current item that the mouse is over. How can I get the current highlighted item in the list and bind it to the user control using only XAML and code in the View Model?
Edit: The following image might be more descriptive of the intended action.
alt text http://img134.imageshack.us/img134/6263/34548010.png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如 eduardo 所说,有时在纯 MVVM 中制定解决方案太复杂了。
如果您重新表述您的问题并提供一些代码,您可以获得更多答案。
As eduardo said, sometimes to make a solution in pure MVVM is too complicated.
if you reformulate your question and provide some code, you can get more answers.