【发布时间】:2020-01-01 05:00:11
【问题描述】:
我的视图模型中有类似的东西
public ObservableCollection<string> UnitSystems { get; set; }
private string selectedUnitSystem;
public string SelectedUnitSystem
{
get { return selectedUnitSystem; }
set { SetProperty(ref selectedUnitSystem, value); }
}
private string _property1Unit;
public string Property1Unit
{
get { return _property1Unit; }
set { SetProperty(ref _property1Unit, value); }
}
在我看来,它们绑定到组合框和标签。当我在组合框中选择其他内容时,我当然想更新标签的值 Property1Unit 和内容。有可能吗?
【问题讨论】:
-
当您想在 Label 中显示选定的项目时,请将 Label 绑定到 SelectedUnitSystem 属性
-
@Sir Rufo 实际上标签的内容不仅仅是选定的项目。根据项目将是其他内容。
-
好的,那么你的问题的答案是:是的,有可能。