Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1015821
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:27:28+00:00 2026-05-16T10:27:28+00:00

I have a ComboBox like this: <ComboBox IsEditable=True ItemsSource={Binding SelectableValues} SelectedValue={Binding SelectedValue} /> SelectableValues

  • 0

I have a ComboBox like this:

<ComboBox IsEditable="True" 
          ItemsSource="{Binding SelectableValues}"
          SelectedValue="{Binding SelectedValue}" />

SelectableValues is a list of double and SelectedValue is a double. If the user chooses a value from the list or manually enters one of those values, my SelectedValue property is updated. But if the user manually enters another value, it isn’t. How do I allow SelectedValue to take other values than those in ItemsSource?

Edit: Think of it like the font size box in MS Word. I can choose a value from the list, or provide my own value.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:27:28+00:00Added an answer on May 16, 2026 at 10:27 am

    Create a user control inheriting comboBox. Add a dependency property as ‘SelectedText’. create event handler for LostFocus on combo box, in event handler assign the entered value dependency property ‘SelectedText’.
    do binding on ‘SelectedText’, in its setter if value is new then ad to collection and set SelectedValue to new one.

    Indirectly you have to update source by adding new property in ComboBox.

    
      public class ExtendedComboBox : ComboBox
        {
            public ExtendedComboBox()
            {
                this.IsEditable = true;
                this.LostFocus += ComboBox_LostFocus;
            }
            public string SelectedText
            {
                get
                {
                    return (string)GetValue(SelectedTextProperty);
                }
                set
                {
                    SetValue(SelectedTextProperty, value);
                }
            }
    
            public static readonly DependencyProperty SelectedTextProperty = DependencyProperty.Register("SelectedText", typeof(string), typeof(ExtendedComboBox), new FrameworkPropertyMetadata(string.Empty, new PropertyChangedCallback(OnSelectedTextPropertyChanged)));
    
    
            private static void OnSelectedTextPropertyChanged(object sender, DependencyPropertyChangedEventArgs e)
            {
    
            }
    
            private void ComboBox_LostFocus(object sender, RoutedEventArgs e)
            {
                SelectedText = (e.Source as ComboBox).Text??string.Empty;
            }
    
        }
    
       // Binding Example
    
     %gt%local:ExtendedComboBox Margin="3" x:Name="ecb" SelectedText="{Binding SelectedText,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding SelectedTextList}">%gt/local:ExtendedComboBox>
    
    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a combobox in WPF like this: <ComboBox Text=Select Language... IsEditable=True IsReadOnly=True ItemsSource={Binding
I have a view with a ComboBox like this <ComboBox Name=cmbPurpose DisplayMemberPath=@value SelectedValuePath=@key ItemsSource={Binding
I have a ComboBox that it looks like this: <ComboBox ItemsSource={Binding JobList} SelectedValue={Binding Job,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}
I have a combobox (ItemsSource={Binding Path=AvailableDrives}). The AvailableDrives property is defined like this: public
So I was have a combobox like below, coded like this; AllowsTransparency=True Background=Transparent> <Border
Say I have a ComboBox , like so: <ComboBox IsEditable=True Height=30> <ComboBoxItem>robot</ComboBoxItem> <ComboBoxItem>Robot</ComboBoxItem> </ComboBox>
I have some Company names as Items in a ComboBox like this: 123 SomeCompany
I have a ComboBox with a label function like this one: private function fieldLabelFunction(item:Object):String
I have a wpf app with a combobox like this <ComboBox name=cmbBx1> <ComboBoxItem Name=Jan>January</ComboBoxItem>
I have a combobox inside of my WPF DataGrid. It is created like this:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.