How to add option (none) and (new) to itembinding combobox
-
Usually we use ItemSource property to set comboboxitems automatically. However, we also often hope to attach the following two options to the dropdownitems of combobox. (None): Sometimes we need to reset the value to none. but the itembinding combobox doesn't offer. You have to select one value. (Add); We also want to add a new value when the itembinding data doesn't include what we want. And we don't want to go to another page to initial this request. I think it is a common function about combobox. but the bad thing is I can not find a good template for this. Would anyone know about it? Thanks in advance for your help.
-
Usually we use ItemSource property to set comboboxitems automatically. However, we also often hope to attach the following two options to the dropdownitems of combobox. (None): Sometimes we need to reset the value to none. but the itembinding combobox doesn't offer. You have to select one value. (Add); We also want to add a new value when the itembinding data doesn't include what we want. And we don't want to go to another page to initial this request. I think it is a common function about combobox. but the bad thing is I can not find a good template for this. Would anyone know about it? Thanks in advance for your help.
Well, you could always do a variation of the technique I describe in my blog entry here[^].
Forgive your enemies - it messes with their heads
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
-
Well, you could always do a variation of the technique I describe in my blog entry here[^].
Forgive your enemies - it messes with their heads
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
The article is great :thumbsup:. But the CompositeCollection is not included in silverlight in which my platorm is.
-
Usually we use ItemSource property to set comboboxitems automatically. However, we also often hope to attach the following two options to the dropdownitems of combobox. (None): Sometimes we need to reset the value to none. but the itembinding combobox doesn't offer. You have to select one value. (Add); We also want to add a new value when the itembinding data doesn't include what we want. And we don't want to go to another page to initial this request. I think it is a common function about combobox. but the bad thing is I can not find a good template for this. Would anyone know about it? Thanks in advance for your help.
I usually take a copy of the list servicing the combo and insert a couple of dummy records into the start of the list. Then you need to detect the content in the SelectedObject and deal with it when it is "Add"
Never underestimate the power of human stupidity RAH
-
The article is great :thumbsup:. But the CompositeCollection is not included in silverlight in which my platorm is.
Thanks for that, but if I were you I would include vital information such as platform in future just so you don't get answers like mine.
Forgive your enemies - it messes with their heads
"Mind bleach! Send me mind bleach!" - Nagy Vilmos
My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility