How to display two tables in a grid view / tree structure, displaying columns for both parent and child tables (when the child is expanded)

I am trying to use a TreeView / DataGrid to display some data. I need to display columns for top level elements, but also display a header for the advanced level.

I have a dataset with two tables, for example. Orders and items, items have a foreign key for Orders.

Dataset from visual studio

I am trying to bind a dataset to a datagrid / tree view to show a list of orders.

WinFrom DataGrid can display several tables from a DataSet:

Data Grid Example

What I installed with:

dataGrid.DataSource = dataSet;
dataGrid.DataMember = "Orders";

Pressing [+] expands the line to show the link:

Expanded data grid

After this link, the Items table appears:

DataGrid Items shown

What I need is a combination of both, but in WPF:

Merged

, .., WPF , .

TreeListView, , , , . - , .

. . @offapps-cory ListView . 1- :

enter image description here

, :) , , ...

+3
1

ListBox ListViews, ? ListViews, ListBoxes , .

, , , TreeViewItem ItemPresenter, ItemsPresenter Panel, ListView - .

DataTemplate ListView/GridView . , , , , .

+2

Source: https://habr.com/ru/post/1786451/


All Articles