Tuesday, 15 September 2015

mvvm - Generate dynamic columns and bind data dynamically for WPF Datagrid or DevexGridcontrol -



mvvm - Generate dynamic columns and bind data dynamically for WPF Datagrid or DevexGridcontrol -

i have next info structure:

public class studentscore { public string scorevalue{ get; set; } } public class pupil { public string studentname { get; set; } //scores.count = enddate-startdate public observablecollection<studentscore> scores { get;set; } } observablecollection<student> students { get; set; } public datetime startdate { get; set; } //can changed user dynamically public datetime enddate { get; set; } //can changed dynamically

what interested accomplish in wpf datagrid/devexpress gridcontrol follows: column 1 fixed, pupil name , remaining columns based on number of scores , each row should populate pupil name , scores.

and each cell should have 2 way binding user can edit score reflect in actual vm property.

tried set autogeneratecolumns property true - generates 2 columns because have studentname , scores properties. need thing can generate columns collection each row.

you can bind grid columns via gridcontrol.columnssource property. please review approach detailed description in next help article: binding collection of columns.

wpf mvvm datagrid devexpress

No comments:

Post a Comment