2016-09-29 205 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}" 

,組合框的文本字段開始工作