wpf mvvm将依赖项属性绑定到viewmodel属性 [英] wpf mvvm bind dependency property to viewmodel property

查看:670
本文介绍了wpf mvvm将依赖项属性绑定到viewmodel属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在视图中使用了带有selecteditem依赖属性的扩展树视图控件。我绑定了viewmodel list属性中的treeview数据。现在,当用户在扩展树视图中选择一个项目时,我能够在依赖项属性类中查看所选项目。



但是我想在我视图的视图模型中访问这个属性来处理它。



如果有人有想法解决这个问题,请回复我。



提前致谢。

I have used a extened treeview control with selecteditem dependency property in my view. I am binding the treeview data from the viewmodel list property. Now when the user selects an item in the extended treeview I am able to view the selected item in the dependency property class.

But I want to access this property in my view''s view model to work on it.

If anyone have idea to solve this please reply me.

Thanks in advance.

推荐答案

您好

我最近发布了一个可能的(和工作)答案,类似于这个帖子。

因为WPF TreeView不支持这个,我的答案就是轻松一点创建TreeView扩展并在那里公开DependencyProprty的解决方案。



wpf mvvm treeview获取选定项目



希望它有所帮助!
Hello
I recently posted a possible (and working) answer to a post similar to this.
Because the WPF TreeView does not support this, my answer is to make an easy solution to create an extension of the TreeView and expose the DependencyProprty there.

wpf mvvm treeview get selected item

Hope it helps!


这篇关于wpf mvvm将依赖项属性绑定到viewmodel属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆