I am new in MVVM and WPF world. I've been looking for an answer to this question with no luck. I wanna bind a datagrid using an ObservableCollection which is in my ViewModel class but the data that feeds my ObservableCollection comes from 2 different tables looking something like this:
Table Location:
- id
- name
- locationTypeId
- isActive
Table LocationType:
- id
- name
- isActive
So in my ViewModel class I'm not able to have something like this:
public class LocationListViewModel
{
ObservableCollection< Model.Location> dataSource;
}
without modifiying my Model class to something like this:
public class Location
{
public Int32 id {set; get;}
public String name {get; set;}
public Int32 locationTypeId {set; get;}
public Boolean isActive {get; se;}
//added property to get the location name
public String locationTypeName {set; get;}
}
All the examples I've seen so far for databinding and viewmodels use as example a simple class that comes from a table as a type for the observablecollection.
Thanks in advance.