Adding predefined item to a ComboBox with ItemsSource

后端 未结 2 1768
死守一世寂寞
死守一世寂寞 2021-01-19 15:43

I\'m trying to add a predefined ComboBoxItem into my ComboBox which already has a ItemsSource property set. example:

(Select item)
Item 1
Item 2
Item 3
         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-19 16:12

    Here is some sample code from MSDN that shows the usage of CompositeCollection:

    
        
            
                Please Select
                
            
        
    
    

    Here are some references to show you the usage of CompositeCollection:

    1- http://msdn.microsoft.com/en-us/library/system.windows.data.compositecollection.aspx

    2- http://robertbouillon.com/2010/04/17/adding-items-to-a-data-bound-wpf-combobox/

    3- How do I convert a ComboBox to use a bound CompositeCollection?

提交回复
热议问题