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 754167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:58:52+00:00 2026-05-14T14:58:52+00:00

I have a Dictionary which is binded to a combobox. I have used dictionary

  • 0

I have a Dictionary which is binded to a combobox. I have used dictionary to provide spaces in enum.

public enum Option {Enter_Value, Select_Value};

Dictionary<Option,string> Options;

    <ComboBox                                        
        x:Name="optionComboBox"
        SelectionChanged="optionComboBox_SelectionChanged"
        SelectedValuePath="Key"
        DisplayMemberPath="Value"
        SelectedItem="{Binding Path = SelectedOption}"
        ItemsSource="{Binding Path = Options}" />

This works fine.

My queries:

1. I am not able to set the initial value to a combo box.
In above XAML snippet the line

SelectedItem="{Binding Path = SelectedOption}"

is not working. I have declared SelectOption in my viewmodel. This is of type string and I have intialized this string value in my view model as below:

SelectedOption = Options[Options.Enter_Value].ToString();

2. The combobox is binded to datadictionary which have two options first is “Enter_value” and second is “Select_value” which is actually Option enum.

Based on the Option enum value I want to perform different action.

For example

if option is equal to option.Enter_value then

Combo box becomes editable and user can enter the numeric value in it.

if option is equal to option.Select_value value then

the value comes from the database and the combo box becomes read only and shows the fetched value from the database.

Please Help!!

  • 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-14T14:58:53+00:00Added an answer on May 14, 2026 at 2:58 pm

    Try binding SelectedValue, not SelectedItem if SelectedOption is of type Option.

    About your second question: Based on selection you can hide your ComboBox and display a TextBlock or TextBox in it’s place. Or you can use RadioButtons and enable or disable input accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dictionary which store a string as the key, and an integer
I have a dictionary which is of type Dictionary [string,handler_func] where handler_func is a
I have an interface called Dictionary which has a method insert() . This interface
I have a Dictionary<string, someobject> . EDIT: It was pointed out to me, that
I have a Dictionary<string,int> that has the potential to contain upwards of 10+ million
i have three listboxes, whose itemsSource is binded to a list, list and dictionary.
I have a Dictionary which I am comparing to another Dictionary (variables typed as
I have a dictionary which is filled once in a static constructor and stays
I need to implement a search engine. So I have a dictionary which is
I have a dictionary which has coordinate pairs as a keys: i.e.: d =

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.