UserControl如何与ViewModel Atribute绑定 [英] UserControl how to to bind with ViewModel Atribute
本文介绍了UserControl如何与ViewModel Atribute绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要设计一个UserControl和一个表示此UserControl的ViewModel,我想在MainWindow中使用此UserControl.
我的ViewModel有一个ObservableCollection属性,我想将此属性绑定到UserControl内的列表框,但是当MainWindow显示时它没有显示任何东西,
谁可以给我写一篇简单的文章?
I want to design a UserControl and a ViewModel which represents this UserControl,I want to use this UserControl in MainWindow .
my ViewModel has a ObservableCollection Atribute, I want to bind this Atribute to listbox inside UserControl , but it did not show any thing when MainWindow show up,
who could give me a simple article about it?
推荐答案
我自己解决了这个问题,DataContext是做到这一点的关键
I solved it by myself, DataContext is key for do that
这篇关于UserControl如何与ViewModel Atribute绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文