来自2个来源的WPF组合框绑定 [英] WPF combobox binding from 2 source
问题描述
我是新手。
我有 ObservableCollection< MyClass>类
绑定到 ComboBox。
我想绑定到此 ComboBox
也是我的: string DefaultString = Empty
,因为我不能(也不想)将其添加到我的收藏中。 / p>
像这样的东西:
| --------- |
-空
更改后:
| ---- ----- |
-空
-Class1
可以在xaml中完成,就像对一个元素进行两次绑定一样吗?我应该寻找什么?
我应该寻找什么?
如何:实现CompositeCollection: https://msdn.microsoft.com/ zh-cn / library / ms742405(v = vs.110).aspx
您如何将CollectionContainer绑定到视图模型中的集合?
I'm new to binding.
I have ObservableCollection<MyClass> Classes
binded to ComboBox.
I would like to bind to this ComboBox
also my: string DefaultString = "Empty"
because I cant (and I dont want to) add it to my collection.
Sth like this:
|---------|
-Empmty
And after changes:
|---------|
-Empty
-Class1
It's possible to do it in xaml, like two bindings to one element? What I should be looking for?
What I should be looking for?
The CompositeCollection class.
How to: Implement a CompositeCollection: https://msdn.microsoft.com/en-us/library/ms742405(v=vs.110).aspx
How do you bind a CollectionContainer to a collection in a view model?
这篇关于来自2个来源的WPF组合框绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!