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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:00:35+00:00 2026-05-13T08:00:35+00:00

Question: How do you set the binding for a ComboBox’s Selected items to one

  • 0

Question: How do you set the binding for a ComboBox’s Selected items to one property and the items list to a different property?


Info:

I have an inventory program I’m working on for my company which is aimed mostly at the people who receive shipments as they come in. I have things set up so that there is a list of shipments on one side of the screen. when they select one of these all the information on the shipment is displayed so it can be edited. one bit of information is the person who received the shipment. I want it so that when they click the shipment, obviously the user who received the shipment is the one who pops up in the combo box. but i want the combo box to contain the list of all the other users.

This wouldn’t be to hard if it weren’t for the fact that I’m pulling the list of users from a database. the list box has a data template for pulling the proper information out of the list of user data types. what I’ve tried so far is to have a collection view in the viewmodel that the combo box binds to for its list, then a seperate property which is a single user instance that comes with the shipment data type.

I’m programing in Visual Basic and XAML according to the M-V-VM programing model.

  • 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-13T08:00:36+00:00Added an answer on May 13, 2026 at 8:00 am

    There is nothing wrong with your approach. The ViewModel can expose a collection of types from the db and a separate property bound to the selected item, something like:

    public ObservableCollection<Shipment> AllShipments { get; private set; }
    public Shipment SelectedShipment { get; set; }
    
    // Constructor
    public MyViewModel()
    {
        AllShipments = ReadFromDb();
    }
    

    In terms of the combobox being empty

    • Have a look in the output window in VS when you start your app – is there a line complaining about a Binding failing?
    • Double-check the spellings of your properties against your xaml Binding
    • Put a breakpoint on the AllShipments getter to make sure it is not null when the View instantiates the binding. If you read the db in the VM’s constructor (as above) then this will be OK.

    Also – if you want the combo-box to display the User from the shipment object, then remember to ensure your VM (or its base) implements INotifyPropertyChanged, and raises a PropertyChanged event in the SelectedShipment setter – this will propagate the change through to the View via the DataBinding…

    hope this helps 🙂

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

Sidebar

Related Questions

As described in another question , I have a set of Model objects and
I have a Question class: class Question { public int QuestionNumber { get; set;
Hi I am quite new to Powershell but I have one niggling question. I
As the question says, how do I set the value of a DropDownList control
After reading the Test-and-Set Wikipedia entry , I am still left with the question
Simple question, but I haven't found a good explanation on google. When using Set
This question relates to this question . I have a EF model like this
There are a set of questions that seem to be commonly-used in interviews and
Question as stated in the title.
Question is pretty self explanitory. I want to do a simple find and replace,

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.