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

  • SEARCH
  • Home
  • 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 1071991
In Process

The Archive Base Latest Questions

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

I am able to bind a MyDictionary.Value to a ComboBox and see the Values

  • 0

I am able to bind a “MyDictionary.Value” to a ComboBox and see the Values in it:

Dictionary<string, Friends> friend_list = new Dictionary<string, Friends>();
Friend_chat_list.ItemsSource = friend_list.Values;

And here is the XAML code:

<ComboBox x:Name="Friend_chat_list" Width="90" ItemsSource="{Binding}" SelectionChanged="Friend_chat_list_SelectionChanged">
    <ComboBox.ItemTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Name}" TextTrimming="WordEllipsis"/>
        </DataTemplate>
    </ComboBox.ItemTemplate>
</ComboBox>

Here is the class I used to create my dictionnay:

public class Friends
{
    public string Friend_guid { get; set; }
    public string Name { get; set; }
    public string Message { get; set; }
    public string FriendAvatar { get; set; }
    public string Status { get; set; }
    public string Status_Image { get; set; }
    public List<Chat> chat_list { get; set; }
}

What I would like to do is bind the string “Friend_guid” as a ValueMember and not a DisplayMEmber, that I could retrieve on event “SelectionChanged”. The user would only see the “Friend_name” in the combobox but it would return me “Friend_guid” instead of “Friend_name”.

Help would be greatly appreciated.

Ephismen.

  • 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-16T20:47:28+00:00Added an answer on May 16, 2026 at 8:47 pm

    xaml —

    <
    ComboBox x:Name=”Friend_chat_list” Width=”90″ ItemsSource=”{Binding MyFirendsList.Values}”
    SelectionChanged=”Friend_chat_list_SelectionChanged”
    DisplayMemberPath=”Name”
    SelectedValuePath=”Friend_guid”
    >

        </ComboBox>
    

    Code Behind

    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
    
            MyFirendsList  = new Dictionary<string, Friends>();
    
            MyFirendsList.Add("1", new Friends() { Friend_guid = Guid.NewGuid().ToString(),Name = "Saurabh" });
            MyFirendsList.Add("2", new Friends() { Friend_guid = Guid.NewGuid().ToString(), Name = "Nitya" });
    
            this.DataContext = this;
    
        }
    
        public Dictionary<string, Friends> MyFirendsList { get; set; }
    
        private void Friend_chat_list_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
              MessageBox.Show((sender as ComboBox).SelectedValue.ToString());
        }
    }
    
    public class Friends
    {
        public string Friend_guid { get; set; }
        public string Name { get; set; }
        public string Message { get; set; }
        public string FriendAvatar { get; set; }
        public string Status { get; set; }
        public string Status_Image { get; set; }
    
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In WPF and SubSonic 2 using Active Record, I was able to bind to
I would like to be able to programmatically bind some data to the dependency
I am able to bind my datasource to the textblock for the display text.
I'm struggling to be able to bind a StatusBarItem content element in my view
I've added a toolbar to my grid I'm not able to bind the event
I've noticed that in .Net 4 , WPF FrameworkElements are able to bind to
I'm able to bind to a child's Background if the child is explicitly named
I want to bind a List to a WPF combobox in xaml. Wondering what
I'm not able to bind events to a list that is generated by jQuery.
Is there any way to bind arguments to slots ala boost::bind ? Here's a

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.