I need a solution for this.
I need to create a view model for grid view. This viewmodel should be a strong typed one. ex.
List<Person> lstPersons=new List<Person>();
something like this. also, with this I should be able to have custom column header names. I can go with data annotation with enabling AutoGenerateColumns="True"
like,
class Person
{
[DisplayName("Person Name")]
public string name { get; set; }
}
something like this. But I have 2 issues with this.
-
I donno how to change this display name at run time.
-
Im using telerik RADGridView. with that when I’m using
AutoGenerateColumns="True"andShowColumnFooters="True", the whole UI get stucked. I think this s an error with telerik controls. So I have to define all columns in XAML and add binding path for each as well.
Anyway, This is possible with DataTable I think. but I feel data tables are very oldie struct and heavy object.
How to create a Viewmodel to achieve this? Any suggestions ?
Feel free to ask any question. im not sure above description is clear to everyone.
You can continue to use the
DisplayNameattribute on your model, but as you pointed out, cannot change it at run-time. To do so, implement a dictionary in your ViewModel that populatesI think the show column footers deal is a Telerik issue as you suggested.