WPF DataGrid Entity Framework: Is it possible to bind a datagrid column to a method/function? -


I am thinking that is it possible to pair gridcold (field) on any method or function of an entity?

For example, I have two organizations and companies, which are both abstract entity edersasi, I am listing all Addressees (both individuals and companies) in my grid. I have a column, name in the datagrid, which I want to bind to a function GetName (). This function unit is part of Entrecise and gives the company name (if the company) or FirstName + "+ Last name (if the person) on the basis of this address.

I have also tried partially adding the class Addressee to a property which does the same thing as the function, but it fails when I am saving in the database because the column The name does not exist in the database.

Can anyone help me? : -)

How this was how ViewModel was born. You should not change your model according to your view.

  • Hold the other derived properties
  • East > public class AddresseeViewModel {private reading Addressee addressee; // Your Model Public String Firstname // Your FirstDem Property {Get {return addressee.FirstName; } Set {addressee.FirstName = value; OnPropertyChanged ("First"); }} Public string name {// Add your property property logic}}

    Comments