.net - Why does this code not bind SelectedItem to a property? -
i'm pretty new xaml, , first task in new job untangle particularly malodorous collection of spaghetti code. learning xaml @ same time untangling horror-show proving beyond me, apologies homework-level questions i'm asking, these days.
anyway, have following xaml code:
<usercontrol.resources> <collectionviewsource x:key="xmlobjectgroups" source="{binding path=xmlobjectlist}"> <collectionviewsource.groupdescriptions> <propertygroupdescription propertyname="isdatetype"/> </collectionviewsource.groupdescriptions> <collectionviewsource.sortdescriptions> <scm:sortdescription propertyname="isdatetype" direction="ascending"/> <scm:sortdescription propertyname="ordernumber" direction="ascending"/> </collectionviewsource.sortdescriptions> </collectionviewsource> <usercontrol.resources> ... <listview datacontext="{staticresource xmlobjectgroups}" itemcontainerstyle="{staticresource xmlitemstyle}" itemssource="{binding}" selecteditem="{binding path=selectedorder}">
on second line xmlobjectlist
readonly property of viewmodel class, returning collections.objectmodel.readonlyobservablecollection(of myorder)
.
on final line selectedorder
property of same viewmodel class, allows setting , getting of myorder object.
i have confirmed xmlobjectlist
being correctly referenced renaming property, mistyping string, breakpoints, etc. xmlobjectlist
references xmlobjectlist
property of particular viewmodel class.
the selectedorder
property, however, never accessed @ runtime, meaning isn't hooked selecteditem of listview.
as far reading around subject goes, , far answers got similar question yesterday, code have should working, isn't. doing wrong, here?
try changing following:
<listview itemcontainerstyle="{staticresource xmlitemstyle}" itemssource="{binding source={staticresource xmlobjectgroups}}" selecteditem="{binding path=selectedorder}">
Comments
Post a Comment