c# - How can I modify an instance of the button defined in a Cell Header? -
i have following xaml class:
<listview controls:listviewcolumns.stretch="true" name="mylistitems" selectionmode="single"> <listview.view> <gridview> <gridviewcolumn width="50"> <gridviewcolumn.header> </gridviewcolumn.header> <gridviewcolumn.celltemplate> <datatemplate> <button name="btndelete" horizontalcontentalignment="center" verticalcontentalignment="center" padding="0" margin="0" isenabled="{binding converter={staticresource inverseboolconverter}, relativesource={relativesource findancestor, ancestortype={x:type wo:opcomptab}}, path=disableall}" click="btndelete_click" tag="{binding path=.}"> <image source="/win7;component/images/icons/remove.png" width="{staticresource iconwidth}" height="{staticresource iconheight}" /> </button> </datatemplate> </gridviewcolumn.celltemplate> </gridviewcolumn> </gridview> </listview.view> </listview>
the listview gets populated hooking observable collection itemsource property. generates neat looking column of delete buttons each item in observable collection.
but presents quandary: how access "btndelete" of individual row of listview? i'd change icon on per-row basis. matter of binding observable collection cell template somehow?
instead of hardcoding image.source, bind property in row object. way create value converter , pass in row or property if can't or don't want modify row object add imagesource property. have value converter return correct image source based on passed in property or other logic.
Comments
Post a Comment