joe*_*joe 4 data-binding wpf combobox code-behind
如何通过codebehind.cs文件将IList项绑定到a ComboBox.请用简单的步骤解释.
我需要双向绑定的步骤,而不是设置ItemsSource.
我需要这样的东西:
myComboBox.SetBinding(ItemsControl.ItemsSourceProperty,
new Binding { Source = myList });
Run Code Online (Sandbox Code Playgroud)
但我SelectedItem也需要.
谢谢
Sam*_*ack 10
你的意思是这样的吗?
myComboBox.SetBinding(
ItemsControl.ItemsSourceProperty,
new Binding { Source = myList });
myComboBox.SetBinding(
Selector.SelectedItemProperty,
new Binding("SelectedItem") { Source = mySelectedItemSource});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8763 次 |
| 最近记录: |