This sounds like the job of a view model, so I would favour option 3, and create a CustomerViewModel which wraps your Customer model and adds the additional property you require. I'm assuming that this additional property is just for display purposes only which is why you are reluctant to add it to the Customer model.
Up vote 0 down vote favorite share g+ share fb share tw.
I have a Customer class generated from LINQ. This class is being used in many places. I can bind a collection of Customers to a DataGrid (WPF).
I would like to add an extra column to the DataGrid. The column data would depend on how the Customer class is used. Here are the options I have tried: Add the extra property in the Customer class.
This works but the property does not belong here since it may depend on how the class is used. Create another class that derives from Customer. This does not work as we cannot cast Customer to the derived class and a list of Customers is what I get back from database.
Create another class that contains a Customer and reimplements all the relevant properties. This is ugly. Create an extension method for the desired property.
Unfortunately, we cannot bind a DataGrid column to an extension method. At this point, these options either do not work or are not ideal. I would appreciate any suggestion.
Wpf datagrid link|improve this question asked Feb 6 '11 at 23:15Alex1.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.