c# - Creating Dynamic nested GridView -
i have following class structure -
public class details { public string customer { get; set; } public string serial { get; set; } public string model { get; set; } } public class summary { public string header { get; set; } public list<details> details { get; set; } }
i following this link structure requirement.
my requirement having gridview
dynamic no of columns mapped list of summary
class. header mapped gridviewcolumn
header. till fine. details
property, want create again child gridview
having dynamic no. of columns mapped list of details
class , rows defined in details
class properties. can 1 tell me correct solution.
edit link updated
what tried yet
public class dynamicgridviewconverter: ivalueconverter { #region ivalueconverter members public object convert(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { var dynamicconfig = value list<summary>; if (dynamicconfig != null) { var gridview = new gridview(); foreach (var linecolumn in dynamicconfig) { datatemplate template = new datatemplate(); frameworkelementfactory frameworkgrid = new frameworkelementfactory(typeof(grid)); frameworkelementfactory frameworklistview = new frameworkelementfactory(typeof(listview)); gridview internalgridview = new gridview(); gridviewcolumn col1 = new gridviewcolumn(); col1.displaymemberbinding = new binding("customer"); col1.header = "customer header"; internalgridview.columns.add(col1); gridviewcolumn col2 = new gridviewcolumn(); col2.displaymemberbinding = new binding("serial"); col2.header = "serial header"; internalgridview.columns.add(col2); gridviewcolumn col3 = new gridviewcolumn(); col3.displaymemberbinding = new binding("model"); col3.header = "model header"; internalgridview.columns.add(col3); frameworklistview.setvalue(listview.viewproperty, internalgridview); var itemsourcebinding = new binding(); itemsourcebinding.source = linecolumn.details; frameworklistview.setbinding(listview.itemssourceproperty, itemsourcebinding); frameworkgrid.appendchild(frameworklistview); template.visualtree = frameworkgrid; gridview.columns.add(new gridviewcolumn() { header = linecolumn.header, celltemplate = template, width=200}); } return gridview; } return binding.donothing; } public object convertback(object value, type targettype, object parameter, system.globalization.cultureinfo culture) { throw new notimplementedexception(); } #endregion }
it showing view can not shared more 1 listview
what part missing?
Comments
Post a Comment