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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T11:06:13+00:00 2026-06-14T11:06:13+00:00

In my C# application I’m calling a method which returns an array: projectArray =

  • 0

In my C# application I’m calling a method which returns an array:

projectArray = client.getProjectList(username, password);

As I’d like to refactor the application to WPF using the MVVM pattern I should use an ObservableCollection for the project list.

My view model contains:

// Members
CProject[] projectArray;
ObservableCollection<CProject> projectList;

// Properties
public ObservableCollection<CProject> ProjectList {
  get { return projectList; }
  set {
    projectList = value;
    OnPropertyChanged("ProjectList");
  }
}

And the code for setting the property:

projectArray = client.getProjectList(username, password);
projectList = new ObservableCollection<CProject>(projectArray);
this.ProjectList = projectList;

Here comes the problem. My view contains a combobox which is bound to the view model’s ProjectList property. The binding works fine. However the combobox displays values like MyApp.SoapApi.CProject. I’d like to display the names of the project which are accessible via CProject.database.name.

What is an appropriate and correct way doing this? I tried using projectList = value.database.name but this is a string which conflicts with the property type CProject.

  • 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-06-14T11:06:14+00:00Added an answer on June 14, 2026 at 11:06 am

    You should set the DisplayMemberPath of your combobox to the path of the property you want to be shown in the combobox text:

    <ComboBox DisplayMemberPath="database.name" />
    

    also, your code can be simplified to just:

    // Members
    ObservableCollection<CProject> projectList;
    
    // Properties
    public ObservableCollection<CProject> ProjectList {
        get { return projectList; }
        set {
            projectList = value;
            OnPropertyChanged("ProjectList");
        }
    }
    
    
    this.ProjectList = new ObservableCollection<CProject>(client.getProjectList(username, password));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Application: WPF Application consisting of a textbox on top and a listbox below Users
Application works fine. I can access everything in debug except for an Array Adapter
My application has one activity which starts two services but does not bind them.
Application : I am working on one mid-large size application which will be used
Application loader supports the creation of inApp-Purchase items via an import template. I'd like
Application is a C# .Net 3.5 WCF Service. I'd like during the build process
APPLICATION and ENVIRONMENT Java EE / JSF2.0 / JPA enterprise application, which contains a
application.rb config.time_zone = 'Athens' I want to list entries which are published between any
Application frameworks such as DotNetNuke, Eclipse, Websphere and so forth are available today which
Application Settings.bundle contains a version number , which is automatically generated during build. From

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.