Combobox with static and dynamic data

后端 未结 1 740
遇见更好的自我
遇见更好的自我 2020-12-31 18:01

I would like to create a combobox that binds to a dynamic resource and has a custom xaml pre-specified list that stays at the top. I know how to bind a combobox to a dynamic

相关标签:
1条回答
  • 2020-12-31 18:18

    CompositeCollection is pretty cool for this. Something like so:

    <ComboBox>
        <ComboBox.ItemsSource>
            <CompositeCollection>
                <CollectionContainer Collection="{Binding Source={...whatever...}" />
                <ComboBoxItem Name="cbi1">Item1</ComboBoxItem>
                <ComboBoxItem Name="cbi2">Item2</ComboBoxItem>
                <ComboBoxItem Name="cbi3">Item3</ComboBoxItem>
            </CompositeCollection>
        </ComboBox.ItemsSource>
    </ComboBox>
    
    0 讨论(0)
提交回复
热议问题