I
I
Ilya2014-12-18 08:08:46
WPF
Ilya, 2014-12-18 08:08:46

How to make a hierarchical view of a DataGrid?

Good day! There was a need to make a table with a hierarchy of 2 levels, as in TreeView. Something like this:
5MbhwIF.jpg
I work with MVVM where there are 2 model classes:

public class part
    {
        public int id { get; set; }
        public int partNumber { get; set; }
        public double mBrutto { get; set; }
        public double mNetto { get; set; }
        public bool exported { get; set; }
        public Nullable<DateTime> dataOtgr { get; set; }
        public List<paket> ListPaket { get;set; }       
    }
    
 
public partial class paket
    {
        public int id { get; set; }
        public int paketNumber { get; set; }
        public Nullable<System.DateTime> dataUpack { get; set; }
        public int smena { get; set; }  
    }

I'm actually creating a collection from the class part and it includes a list of the class paket . I need to display a collection from part in a table and display a List list in the TreeViewItem drop-down element (or something else, it doesn't matter).
How can I do it?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question