wpf - How to use {Binding Path=/} for displaying directly third level of nested collections? -


i have nested entity structure this:

dataobject > universities (list) > colleges (list) > students (list) > projects (list)

i want bind treeview directly dataobject as:

mytreeview.itemsource = dataobject.universities;

        datatemplate datatemplate = new datatemplate();         datatemplate.datatype = typeof(student);         frameworkelementfactory spfactorydeliverable = new frameworkelementfactory(typeof(textblock));         spfactorydeliverable.name = "spfactorydeliverable";         spfactorydeliverable.setbinding(textblock.textproperty, new binding("colleges/students/name"));         datatemplate.visualtree = spfactorydeliverable;         rdtreedeliverables.itemtemplate = datatemplate; 

to display nodes students' names. problem that- display name of single college's student names. not display records of second or further college record.

any suggestion/idea?

{binding path=/} shows current item list, not iterate on list in way - if want show nested lists need type of nested data templates (either hierarchicaldatatemplate or datatemplate itemscontrol in - depending on control template used with).

you should think "flattening" list in code before binding if want use control not work hierarchies.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -