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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:10:34+00:00 2026-06-17T12:10:34+00:00

I have the following classes: public class Order { public string OrderName { get;

  • 0

I have the following classes:

public class Order
{
public string OrderName { get; set; }
public List<Parts> PartsList { get; set; }
}

public class Parts
{
public string PartName { get; set; }
public double PartQuantity { get; set; }
}

In my code I create a list of Order objects

List<Order> myOrders;

I would like to display all of this to the user somehow, like using a stack panel of elements where the first is a TextBox to display OrderName and the second is a Datagrid to display the list of Parts?

Honestly I am trying many different things (I have no requirements on what type of controls to use) but I can never get the PartsList to show correctly (either I get nothing OR I get “Collection” show to the user.

The goal would be to see something like this:

Order1    Part1    7
          Part2    12
Order2    Part1    100
          Part2    1
          Part3    58

Or whatever, headers can be whatever, honestly I am open to many suggestions.

Any help would be much appreciated.

  • 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-17T12:10:36+00:00Added an answer on June 17, 2026 at 12:10 pm

    Would a TreeView work? It would look something like this:

    - Order 1
      * Part A (100)
      * Part B (200)
    + Order 2
    + Order 3
    - Order 4
      * Part C (300)
      * Part D (400)
      * Part E (500)
    + Order 5
    ...
    

    You could do something like this:

    void AddOrderToTree(Order order)
    {
      var orderNode = treeView.Nodes.Add(order);
    
      foreach(var part in order.Parts)
        orderNode.Nodes.Add(part);
    }
    

    But yes, as pointed out, I would use properties like so:

    public class Part
    {
      public virtual string Name { get; set; }
      public virtual double Quantity { get; set; }
    
      public override string ToString()
      {
        return string.Format("{0}: {1}", this.Name, this.Quantity.ToString());
      }
    }
    
    public class Order
    {
      public virtual string Name { get; set; }
      public virtual List<Part> Parts { get; set; }
    
      public override string ToString()
      { 
        return this.Name;
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following classes: public class Order { public string OrderName { get;
I have the following classes: public class Order { public int Oid {get; set;}
I have the following classes [XmlRoot] public class AList { public List<B> ListOfBs {get;
Given the following classes: public class Lookup { public string Code { get; set;
I have the following classes: public class Menu { public int Order { get;
I have the following two classes: public class Address { public string AddressLine1 {
I have the following classes... public class Order { private Guid id; public Guid
If i have the following classes public class Order { public virtual ISet<OrderItem> OrderItems
Suppose, I have following classes: public class DisposableObj : IDisposable { public ChildObj CreateObj();
I have the following classes: Public Class Email Private Shared ReadOnly EMAIL_REGEX = \b[a-zA-Z]+[a-zA-Z0-9._+-]+@

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.