簡體   English   中英

如何在WPF中啟用組合框的自由文本

[英]How to enable Free text for Combo Box in WPF

如何在WPF中啟用組合框的自由文本輸入? 我嘗試使用IsEditable =“True”,但即使這樣也行不通......

我的xaml語法是: <ComboBox SelectedValue="{Binding Path=CountryValue, Mode=TwoWay}" IsEditable="True" ItemsSource="{Binding Path=CountryValues, Mode=OneWay}"></ComboBox>

在網上找到這個: 鏈接

<Window x:Class="LearnWPF.EditableComboBox.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="LearnWPF.EditableComboBox" Height="300" Width="300"
    >
  <Window.Resources>
    <XmlDataProvider x:Key="items" XPath="//item">
      <x:XData>
        <items >
          <item>01</item>
          <item>02</item>
          <item>03</item>
        </items>
      </x:XData>
    </XmlDataProvider>
  </Window.Resources>
    <Grid>
      <ComboBox IsEditable="True" DataContext="{StaticResource items}"
                ItemsSource="{Binding}"/>
    </Grid>
</Window>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM