c# - UWP Win 10 Tinder swipe card inside Pivot? -


firstly here's link minimal version project.
trying create tinder swipe card kind of effect inside pivot page. after referring lightstone carousel able create 1 in c# , xaml works inside grid.
problem custom control should come inside pivot element. pivot's default manipulation overrides control's swipe manipulation on touch devices. how can bubble down custom control.
wasn't able find touchin win 10 app per @romasz answer.
other control suggestion similar effect appreciated. xaml

<pivot>             <pivotitem>             <grid background="white">                 <grid.rowdefinitions>                     <rowdefinition height="*"/>                     <rowdefinition height="3*"/>                     <rowdefinition height="*"/>                 </grid.rowdefinitions>                 <grid grid.row="0" background="lightblue"/>                 <grid grid.row="1" >                     <ctrl:carrousel  grid.row="0" background="green"   itemssource="{binding datas}"                          selectedindex="0"                         transitionduration="2500"                          depth="700"                          maxvisibleitems="15"                         x:name="carrouselelement"                         rotation="50"                          translatey="0"                         translatex ="1200">                         <ctrl:carrousel.easingfunction>                             <cubicease easingmode="easeout" />                         </ctrl:carrousel.easingfunction>                         <ctrl:carrousel.itemtemplate>                             <datatemplate>                                 <grid background="red">                                     <grid.rowdefinitions>                                         <rowdefinition height="auto"/>                                         <rowdefinition height="auto"/>                                     </grid.rowdefinitions>                                     <border borderbrush="#bfbfbf" borderthickness="1">                                         <grid horizontalalignment="stretch">                                             <grid.rowdefinitions>                                                 <rowdefinition height="auto"/>                                                 <rowdefinition height="auto"/>                                             </grid.rowdefinitions>                                             <image source="{binding bitmapimage}" stretch="fill"></image>                                             <border grid.row="1" background="white">                                                 <textblock  text="{binding title}"  fontsize="16" margin="4"/>                                             </border>                                                                                       </grid>                                     </border>                                     <rectangle grid.row="1" height="12" margin="0,0,0,0" verticalalignment="bottom" >                                         <rectangle.fill>                                             <lineargradientbrush endpoint="0.5,1" startpoint="0.5,0">                                                 <gradientstop color="#bfbfbf"/>                                                 <gradientstop color="transparent" offset="1"/>                                             </lineargradientbrush>                                         </rectangle.fill>                                     </rectangle>                                 </grid>                                 </datatemplate>                         </ctrl:carrousel.itemtemplate>                     </ctrl:carrousel>                 </grid>               </grid>         </pivotitem>         <pivotitem>         </pivotitem>         </pivot> 

as per @chris w. query following 2 show tinder swipe effect
1) web version
2) objective c code

to see similar effect in app remove encasing pivot control , pivot items , work fine.

edit per @romasz comment have uploaded new sample. there 2 upper 1 being custom control left , right swipe works vertical swipe doesn't. below default listview scroll swipe works there no tinder kind effect. reason of creating control add effect.

according second sample, add manipulationmode="system,translatex" carrousel. should allow move scrollviewer vertically , swipe through images horizontally:

<ctrl:carrousel  grid.row="0" background="lightgreen" itemssource="{binding datas}" manipulationmode="system,translatex"                  selectedindex="0" transitionduration="2500" depth="700" maxvisibleitems="15" x:name="carrouselelement"                  rotation="50" translatey="0" translatex ="1200"> 

there 1 problem - while vertical scrollviewer working , swipe left/right, on carrousel, pivot react change of item. there 2 ways in situation, think:

  • first, disable inertia of scrollviewer - isscrollinertiaenabled="false". but, solution doesn't nice, thought different way,
  • second, disable pivot while scrollviewer working. case have subscribe viewchanged event of scrollviewer , control pivot's islocked property:

    <scrollviewer viewchanged="scrollviewer_viewchanged" verticalscrollbarvisibility="hidden" horizontalscrollbarvisibility="disabled"> 

    in code behind (i've named pivot):

    private void scrollviewer_viewchanged(object sender, scrollviewerviewchangedeventargs e) => mypivot.islocked = e.isintermediate; 

as changing pivot upon first/last element, think should able handle modifying little carrousel - provide events informing first/last item. upon can invoke pivot change.


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -