xaml - Swipe-select on a GridView Item in MVVM -
i have gridview want able swipe-select items or click on them.
as wanted work mvvm click handled command on button root of item in gridview.
in following simplified example of this:
<gridview itemssource="{binding source={staticresource groupeditemsviewsource}}" isswipeenabled="true" padding="116,0,40,46"> <gridview.itemspanel> <itemspaneltemplate> <virtualizingstackpanel orientation="horizontal"/> </itemspaneltemplate> </gridview.itemspanel> <gridview.itemtemplate> <datatemplate> <button command="{binding clickedcommand}" /> </datatemplate> </gridview.itemtemplate> </gridview>
my problem swipe won't recognized long have button in itemtemplate. command on button seems receive gestures , doesn't allow swipe-select item. when i
doesn have same problem or idea how solve this?
thank you!
i'd avoid using buttons in gridviewitem
s since have conflicting input handling. put content there instead of in button. way i'd use handle itemclick
events, datacontext
event sender (probably gridviewitem
) item view model , invoke command event handler. if dislike code behind - can "gridview itemclick command" favorite search engine , might find attached behavior allows bind commands event.
Comments
Post a Comment