开发者

How to enable Free text for Combo Box in WPF

开发者 https://www.devze.com 2023-02-28 01:15 出处:网络
How can we enable the free text entry for combo box in WPF? I tried with IsEditable=\"True\", but even that is not working...

How can we enable the free text entry for combo box in WPF? I tried with IsEditable="True", but even that is not working...

my xaml s开发者_开发问答yntax is: <ComboBox SelectedValue="{Binding Path=CountryValue, Mode=TwoWay}" IsEditable="True" ItemsSource="{Binding Path=CountryValues, Mode=OneWay}"></ComboBox>


Found this on the web: Link

<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>
0

精彩评论

暂无评论...
验证码 换一张
取 消