WPF USER控件viewmodel绑定 [英] WPF USer Control viewmodel binding
问题描述
同时请分享不同的方法。
我已经在命名空间和用户控件资源标签中添加了viewmodel和view到我的xaml文件。我已经定义了一个数据类型为数据类型的视图模型,添加了我的观点(我的意思是同样的用户控制ih,现在编辑现在是可能的 - 请让我知道)..我已经使用内容控件与content = {Binding} ..和contenttemplate作为一个datatemplate ..在我有我的查询是不同的方式绑定viewmodel在UserControlLibrary项目中查看?
Sdry的权利,您还可以将视图的DataContext属性设置为ViewModel。
此外,这里是一个WPF数据绑定作弊表,可能会在哈ndy: http://www.nbdtech.com/Free/WpfBinding.pdf
HI Can any one suggest me how bind viewmodel to a usercontrol..
Also please share different way of doing that..
I have added viewmodel and view into my xaml file in namespace and in the user control resource tag.. i have defined a data template with data type as the viewmodel wh i have wrote.. inside that i have added my view (i mean the same usercontrol ih which im editing now is it possible -- please let me know).. I have used content control with content={Binding}.. and contenttemplate as a datatemplate.. in that i have reffered the property which i want to bind from viewmodel).. but its not binding as such..
My query is different ways of binding viewmodel to view in UserControlLibrary Project ?
Sdry's right, you can also set the DataContext property of your view to your ViewModel.
Also, here's a WPF databinding cheat sheet that will likely come in handy: http://www.nbdtech.com/Free/WpfBinding.pdf
这篇关于WPF USER控件viewmodel绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!