c# - Create treeview from two different objects -


i have 2 different classes totally unknown of each other. e.g.

public class { public string name{get; set;} }  public class b { public string name{get; set;} } 

i want create treeview such that:

-object a

--object b

--object b

i find tutorials objects know each other or being part of another. below view's xaml. in viewmodel have lists of these classes (or objects) , filled, see them in debugging. in window see classa (or objecta) no objectb @ all.

i flexible approach below trying, provide more info if required.

the properties in viewmodel datacontext of view.xaml.

xaml

 <treeview name="mytreeview" grid.column="0" width="auto" height="300" itemssource="{binding list<classaproperty>}">                 <treeview.resources>                     <hierarchicaldatatemplate  datatype="{x:type classes:classa}" itemssource="{binding list<classa>property}">                                                                                <treeviewitem header="{binding name}"></treeviewitem>                                                </hierarchicaldatatemplate>                     <hierarchicaldatatemplate  datatype="{x:type classes:classb}" itemssource="{binding list<classb>property}">                               <treeviewitem header="{binding name}"></treeviewitem>                                          </hierarchicaldatatemplate>                 </treeview.resources>      </treeview> 


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -