Wpf 无法显示selecteditem

Wpf 无法显示selecteditem,wpf,xaml,selecteditem,Wpf,Xaml,Selecteditem,“我的组合框”在列表中正确显示我的所有数据,但不显示所选项目,而仅显示对象的名称 没有项目模板,它可以正常工作,但我需要它来显示我的数据。我做错什么了吗?如何使我选择的项目显示在同一数据模板中 <ComboBox Grid.Row="2" Grid.Column="1" Style="{StaticResource myComboBox}" x:Name="ComboBoxProtocole" IsEd

“我的组合框”在列表中正确显示我的所有数据,但不显示所选项目,而仅显示对象的名称

没有项目模板,它可以正常工作,但我需要它来显示我的数据。我做错什么了吗?如何使我选择的项目显示在同一数据模板中

<ComboBox Grid.Row="2" 
          Grid.Column="1" 
          Style="{StaticResource myComboBox}" 
          x:Name="ComboBoxProtocole" 
          IsEditable="True" 
          IsTextSearchEnabled="True"
          TextSearch.Text="labelFull"
          ItemsSource="{Binding}"
          >
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Vertical">
                <TextBlock Text="{Binding labelShort}" FontSize="12"/>
                <TextBlock Text="{Binding labelFull}" FontSize="10" />
            </StackPanel>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

您需要设置TextSearch.TextPath=labelFull

<ComboBox Grid.Row="2" 
      Grid.Column="1"           
      x:Name="ComboBoxProtocole" 
      IsEditable="True" 
      IsTextSearchEnabled="True"
      TextSearch.TextPath="labelFull"
      ItemsSource="{Binding}">
        <ComboBox.ItemTemplate>
            <DataTemplate>
                <StackPanel Orientation="Vertical">
                    <TextBlock Text="{Binding labelShort}" FontSize="12"/>
                    <TextBlock Text="{Binding labelFull}" FontSize="10" />
                </StackPanel>
            </DataTemplate>
        </ComboBox.ItemTemplate>
    </ComboBox>

itemsSource绑定到什么?它绑定到我的datacontext,我的objectTextPath的一个可观察的集合,MyMirror没有看到!