.net 如何添加选项";“全部”;使用数据库绑定到WPF中的组合框

.net 如何添加选项";“全部”;使用数据库绑定到WPF中的组合框,.net,wpf,combobox,compositecollection,.net,Wpf,Combobox,Compositecollection,我在WPF中有以下组合框。我知道我可以使用CompositeCollection添加选项ALL,但我不知道如何添加。如果有人能帮我做一个简短的指导,那就太好了 <ComboBox SelectionChanged="ComboBoxOperatingPoints_SelectionChanged" x:Name="ComboBoxOperatingPoints" DropDownOpened="ComboBoxOperatingPoints_Dr

我在WPF中有以下
组合框
。我知道我可以使用CompositeCollection添加选项
ALL
,但我不知道如何添加。如果有人能帮我做一个简短的指导,那就太好了

<ComboBox SelectionChanged="ComboBoxOperatingPoints_SelectionChanged" 
          x:Name="ComboBoxOperatingPoints" 
          DropDownOpened="ComboBoxOperatingPoints_DropDownOpened_1"
          FontSize="30" 
          HorizontalAlignment="Right" 
          Margin="40,40,0,0" 
          VerticalAlignment="Top" 
          Width="200" 
          Height="50"
          IsSynchronizedWithCurrentItem="True"
          ItemsSource="{Binding OperatingPoints}"
          DisplayMemberPath="name"
          SelectedValue="{Binding OperatingPointID,UpdateSourceTrigger=PropertyChanged,TargetNullValue=''}"
          SelectedValuePath="operating_point_id">
</ComboBox>

试试这个():



下载此用户控件:@eranotzap抱歉,我不需要为此作业使用自定义控件。正如我所知,这是有可能与一个复合收集,如果有一种方法来做到这一点,我想学习它。
<ComboBox x:Name="ComboBoxOperatingPoints"  
          SelectionChanged="ComboBoxOperatingPoints_SelectionChanged" 
          Width="200" Height="50"
          IsSynchronizedWithCurrentItem="True"
          DisplayMemberPath="name"        
          SelectedValuePath="operating_point_id">
    <ComboBox.Resources>
        <CollectionViewSource x:Key="comboBoxSource" Source="{Binding Path=OperatingPoints}" />
    </ComboBox.Resources>
    <ComboBox.ItemsSource>
        <CompositeCollection>
            <local:OpPoint name="all" operating_point_id="-1" />
            <CollectionContainer Collection="{Binding Source={StaticResource comboBoxSource}}" />
        </CompositeCollection>
    </ComboBox.ItemsSource>
</ComboBox>