Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Datagrid 2 table binding. MVVM

$
0
0

Im creating an application and on one page, there will be a datagrid showing employees absence record.

The data i need is held in 2 different tables. I havent been using WPF & MVVM for very long and whenever i have had to bind data to a datagrid, i have used an observablecollection like so:

            var noteListInDB = from p in m_model.tblEmployeesNotes
                                        where p.EmployeeID == SelectedItem.EmployeeID
                                        select p;

            noteList = new ObservableCollection<tblEmployeesNote>(noteListInDB);

This allows me to edit, add and delete data from the datagrid and changes are made to the DB using model.SaveChanges();

How would i get the same results by using data from 2 different tables?


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>