Sunday 15 February 2015

wpf - Master-Detail Display with Sorting -



wpf - Master-Detail Display with Sorting -

i have looked @ ~15 threads on topic, none of seem address problem.

i have 2 tables in typed dataset. 1 list of categories primary key categoryid. sec list of items foreign key same categoryid. in dataset, define relationship betweeen 2 tables relctoi.

my wpf form contains listbox listing categories , listbox display items category listbox category user picks. both listboxs sorted name.

my pseudo-xaml looks this:

class="lang-xaml prettyprint-override"><window.resources> <collectionviewsource x:key="cvscategories" source="{binding source={staticresource mydataset}, path=categories}"> <collectionviewsource.sortdescriptions> <scm:sortdescription propertyname="categoryname" /> </collectionviewsource.sortdescriptions> </collectionviewsource> <collectionviewsource x:key="cvsitems" ....same thing items path=items ... </collectionviewsource> <datatemplate x:key="mytemplate" <textblock text="{binding source={staticresource cvsitems}, path=itemname}" /> </datatemplate> </window.resources> <grid datacontext="{staticresource cvscategories}"> <....define columns /> <listbox name="lbxcategories" grid.column="0" itemssource="{binding}" displaymemberpath="categoryname" /> <listbox name="lbxitems" grid.column="1" itemssource="{binding path=relctoi}" itemtemplate="{staticresource mytemplate}"/>

the category listbox works fine item listbox blank. wrong xaml?

wpf xaml listbox

No comments:

Post a Comment