Grouping DataGrid based on two Entity Framework tables

zleug 51 Reputation points
2020-09-21T17:45:43.167+00:00

Hi All.
The Form1 has DataGrid populated from EF table Table1. From Form1 I call Form2 that also has DataGrid with multiple selected items and populated from EF Table2 which is related to Table1. When I selected items in Form2 and click save button the data will save in Table2. Now I would grouping DataGrid in Form1 based on source of Table1 and Table2. Something like this:
26194-groupingdg.jpg

Where Department value from Table2 the rest from Table1. If that is passible. How to it do? I will appreciate for sample and detail explanation.

Thanks.

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,783 questions
{count} votes

1 answer

Sort by: Most helpful
  1. zleug 51 Reputation points
    2020-09-22T14:46:09.037+00:00

    Hi DaisyTian-MSFT. Thanks for reply.
    Both table related by ID field. Table1 has primary key Table1_ID and Table2 has primary key Table2_ID, foreign key Table1_ID. To populate the grouping DataGrid, I'm thinking, your idea is good to create class which include fields from both tables.

    Thanks.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.