WPF DataGrid Entity Framework: Is it possible to bind a datagrid column to a method/function?
Posted
by seddler
on Stack Overflow
See other posts from Stack Overflow
or by seddler
Published on 2010-05-18T09:38:00Z
Indexed on
2010/05/18
9:40 UTC
Read the original article
Hit count: 261
Hi.
I'm wondering if it's possible to bind a gridcolumn (field) to a method or function of an entity?
For example I have two entities Person and Company that both inherit the abstract entity Addressee. In my grid I'm listing all Addressees (both persons and companies). I have a column, Name, in the datagrid that I whish to bind to a function GetName(). This function is part of the entity Addressee and based on what type of addressee it is it returns CompanyName (if company) or FirstName+' '+LastName (if person).
I also have tried to add a partial class Addressee with a property Name that does the same thing as the function descried over, but this failes when I'm saving to database because the column Name does not exist in database.
Can anybody please help me? :-)
© Stack Overflow or respective owner