Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable Free text for Combo Box in WPF

Tags:

c#

wpf

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 syntax is: <ComboBox SelectedValue="{Binding Path=CountryValue, Mode=TwoWay}" IsEditable="True" ItemsSource="{Binding Path=CountryValues, Mode=OneWay}"></ComboBox>

like image 274
Make It Perfect Avatar asked Jan 18 '26 11:01

Make It Perfect


1 Answers

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>
like image 185
Christian Avatar answered Jan 20 '26 04:01

Christian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!