我有一个类WPF组合框绑定更新多个文本框
class Names {
public int id get; set;};
public string name {get ; set};
public string til {set{
if (this.name == "me"){
return "This is me";
}
}
我有一个列表(ListNames),其中包含名称添加到它与组合框
<ComboBox SelectedValue="{Binding Path=id, Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding
ListNames}" DisplayMemberPath="name" SelectedValuePath="id" />
每一件事情的作品结合
我想在用户选择一个项目时在另一个标签字段上显示“提示”。
是否有可能?
帮助!
你的意思是工具提示?或您的Names类中的'直接'属性?应该提示吗?关闭主题,但我会将您的班级重命名为姓名,公共房产应以大写字母开头。你在使用MVVM吗?在您的ViewModel中实现'INotifyPropertyChanged'可以解决您的问题。 –
我使用INotifyPropertyChanged而不是MVVM – LeBlues
就像@Miiite建议使用MVVM模式会使事情变得更容易。将标签文本绑定到ViewModel中的选定项目。 –