WPF ListBox Elastic Scroll on Touch Devices -
i have wpf listbox defined in xaml follows
<listbox horizontalcontentalignment="stretch" itemssource="{binding mycollection}"> <listbox.itemspanel> <itemspaneltemplate> <stackpanel orientation="horizontal"/> </itemspaneltemplate> </listbox.itemspanel> <listbox.itemtemplate> <datatemplate> <dockpanel width="{binding path=actualwidth, relativesource={relativesource mode=findancestor, ancestortype=listbox}}"> <textblock text="{binding displaytext}"></textblock> </dockpanel> </datatemplate> </listbox.itemtemplate> </listbox>
this gives horizontal scrolling list box each item consumes entire width of list box. when using on touch device, dragging finger across list box moves through items in continuous manner, i.e., can drag finger , have last half of first item showing , first half of second item showing.
what i'd item elastically default whichever item taking majority of viewport. example, if drag finger such one-third of first item showing, , two-thirds of second item showing, , release finger, list box "elastically" scroll second item. there way listbox?
Comments
Post a Comment