2016-09-29 214 views
0
<ComboBox IsEditable="True" x:Name="copynotesbox" SelectedItem="{Binding NotesID, Mode=TwoWay}" Grid.Column="0" Grid.Row="0" HorizontalAlignment ="Left" Margin="0,0,0,0" Height="30" Width ="75" FontWeight="Bold" Foreground="DarkBlue" VerticalAlignment="Center" ItemsSource="{Binding NotesCopyObs}" > 
    <ComboBox.InputBindings> 
      <KeyBinding Command="{Binding NotesID}" /> 
    </ComboBox.InputBindings> 
</ComboBox> 

上面是我的代码,其中是一个可编辑的组合框。该框绑定到名为NotesCopyObsList,但我想要输入一个数字并将其绑定到NotesID的选项(如果它不在列表中进行选择)。清单号码完美地工作。我不能加入这个在别处找到答案网上可编辑的组合框绑定

感谢所有

+0

你的问题还不清楚。请妥善解释。 – AnjumSKhan

+0

重复? [http://stackoverflow.com/questions/17805798/wpf-combobox-add-item-when-user-enter-text-in-combo](http://stackoverflow.com/questions/17805798/wpf-combobox-添加项,当用户输入文本,在-COMBO) –

回答

0
Text="{Binding NotesID, Mode=TwoWay}" 

,组合框的文本字段开始工作