本文介绍了WF 4.0中的数据绑定不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
我想在组合框中显示一些数据类型.数据类型包装在以下类中:
i want to display some datatypes in a combobox. the datatypes are wrapped in the following class:
public class TDataTypeBinder: INotifyPropertyChanged { private string name; public string Name { get { return name ; } set { name = value; OnPropertyChanged("Name" ); } } private DataType datatype; public DataType Datatype { get { return datatype; } set { datatype = value; OnPropertyChanged("Datatype" ); } } /// <summary> /// Initializes a new instance of the <see cref="TDataTypeBinder"/> class. /// </summary> /// <param name="valueToSelect"> The value to select.</param> public TDataTypeBinder(string valueToSelect) { Name = valueToSelect; } public event PropertyChangedEventHandler PropertyChanged; private void OnPropertyChanged(string propName) { PropertyChangedEventHandler eh = this .PropertyChanged; if (null != eh) { eh(this , new PropertyChangedEventArgs(propName)); } } }推荐答案
Visual Studio的输出窗口是否给您任何绑定表达式错误?您绑定到 ModelItem.DataTypesDisplayed ,但是 ModelItem 是从哪里来的呢? 另外,您在专门谈论WPF 4时,就可以正常工作了在3.5版中? Does your output window of Visual Studio gives you any binding expression errors? You bind to ModelItem.DataTypesDisplayed, but where does ModelItem come from?Also, you are talking about WPF 4 specifically, you got this working in 3.5?
更多推荐
WF 4.0中的数据绑定不起作用
发布评论