c# - How to Change IsHitTestVisible of GridViewItem in MVVM -
i've tried bind ishittestvisible of gridviewitem using mvvm. i've updated value "false" "true" of particular model , notified view using inotifypropertychanged. not affecting in view. if bind value straight ishittestvisible in setter, working fine. can help on this?
<gridview grid.row="1" name="gvcatalogue" width="auto" height="auto" horizontalalignment="left" horizontalcontentalignment="left" itemssource="{binding path=catalogue, mode=twoway, updatesourcetrigger=propertychanged}" isitemclickenabled="true" > <gridview.itemspanel> <itemspaneltemplate> <virtualizingstackpanel orientation="horizontal" margin="0"/> </itemspaneltemplate> </gridview.itemspanel> <gridview.itemcontainerstyle> <style targettype="gridviewitem"> <setter property="ishittestvisible" value="{binding path=hittestvisible, mode=oneway}"/> </style> </gridview.itemcontainerstyle> <gridview.itemtemplate> <datatemplate> <grid name="itemgrid" righttapped="gvitem_righttapped" width="230" > <grid.columndefinitions> <columndefinition width="*"/> </grid.columndefinitions> <stackpanel grid.column="0" verticalalignment="top" height="260" width="175" orientation="vertical" horizontalalignment="center" > <image source="{binding path=bitmapimage, mode=oneway}" height="250" width="175" horizontalalignment="center"/> </stackpanel> </grid> </datatemplate> </gridview.itemtemplate> </gridview> in viewmodel, i'm updating model "catalogitem" this:
private async task downloadfile(string filelocation, string filename, bool iszip) { catalogueitem.hittestvisible = false; catalogueitem.downloadingprogress = visibility.visible; var uri = new uri(filelocation); var downloader = new backgrounddownloader(); storagefile file = await applicationdata.current.localfolder.createfileasync(filename, creationcollisionoption.replaceexisting); downloadoperation download = downloader.createdownload(uri, file); var progress = new progress<downloadoperation>(progresscallback); await download.startasync().astask(progress); catalogueitem.hittestvisible = true; }
last time checked bindings did not work in style setters in winrt/xaml. mentioned workaround in reply question:
how do bindings in itemcontainerstyle in winrt?
c# xaml mvvm windows-runtime winrt-xaml
No comments:
Post a Comment