Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6927035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:59:45+00:00 2026-05-27T10:59:45+00:00

I need a solution for this. I need to create a view model for

  • 0

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.

  1. I donno how to change this display name at run time.

  2. Im using telerik RADGridView. with that when I’m using AutoGenerateColumns="True" and ShowColumnFooters="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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:59:46+00:00Added an answer on May 27, 2026 at 10:59 am

    You can continue to use the DisplayName attribute on your model, but as you pointed out, cannot change it at run-time. To do so, implement a dictionary in your ViewModel that populates

    public PeopleGridViewModel
    {
        public ObservableCollection<Person> People;
        public Dictionary<string, string> PersonColumnHeaders;
    
        public PeopleGridViewModel()
        {
            // 1. write C# here to snag the property names from the typeof(Person)
            // 2. get the DisplayName attribute value for that property too.
            // 3. add the propertyName.ToString() and the DisplayName string to the dictionary as a key/value pair.
    
            // the result is you have a collection of column headers that start with the defaults from the propertys on the object... but they can be manipulated at run-time, and you don't havem them 100% hard typed like in adcool's example.
        }
    }
    

    I think the show column footers deal is a Telerik issue as you suggested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically I need a hosted solution, where one can create an account for a
This doesn't need to be a real time solution, but are there some log
I edited this question after i found a solution... i need to understand why
I have done research on how to manually create sorting in a grid-view and
Maybe that's not exactly the solution i need, but this is what i want
I need a solution to export a dataset to an excel file without any
I need a solution to read raw binary from any filetype stored on a
I need a solution where a user could enter the URL of a web
I need a solution to embed a pdf inside a flash screen i.e. want
Folks, I need a solution that allows drag-and-drop cell over the table. The cells

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.