Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
60
How to Navigate the XamDataCarousel via TouchMove Event wth Surface 2.0 Environment
posted

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

I am using the code below, code that I modified from XamCarouselPanel, to move items to the left and right but does not work. The Navigation Control works with the Mouse - I just want to emulate what via Tocuh what I can do with the Mouse but with Touch instead.

Here is the XAML and C# code:

 

<igDP:XamDataCarousel
   Grid.Row="2"
   x:Name="productCarousel"
   DataContext="{Binding}"
   DataSource="{Binding ProductDataView}"
   TouchDown="ProductCarouselTouchDown"
   TouchEnter="ProductCarouselTouchEnter"
   TouchLeave="ProductCarouselTouchLeave"
   TouchMove="ProductCarouselTouchMove"
   GotTouchCapture="ProductCarouselGotTouchCapture"
   RenderTransformOrigin="0.5,0.5"
   MouseDown="ProductCarouselMouseDown"
   TouchUp="ProductCarouselTouchUp"
   ClipToBounds="False"
   CellActivated="ProductCarouselCellActivated"
   RecordActivated="productCarousel_RecordActivated"
   UpdateMode="OnCellChange"
   AutoFit="False"
   SelectedItemsChanged="productCarousel_SelectedItemsChanged"
   CellChanged="productCarousel_CellChanged"
   IsNestedDataDisplayEnabled="False"
   Initialized="productCarousel_Initialized"
   Theme=""
   FontFamily="Calibri"
   FontSize="10.667"
   GroupByAreaLocation="None"
   InitializeRecord="ProductCarouselInitializeRecord" Margin="0,8,41.333,8" ScrollingMode="Immediate">
   <igDP:XamDataCarousel.Resources>
    <Path
     x:Key="HorizontalPath"
     x:Name="horizontalPath"
     Margin="0,0,0,0"
     HorizontalAlignment="Left"
     VerticalAlignment="Top"
     Height="Auto"
     Width="Auto"
     Stretch="Fill"
     Opacity="1"
     Data="M 9,250 C9,250 491,250 491,250 "
     Stroke="#FFB4B4B4"
     StrokeThickness="1"/>
       
    <Path 
     x:Key="MACCarousle"
     x:Name="horizontal" 
     Margin="1,1,1,1" 
     HorizontalAlignment="Left" 
     VerticalAlignment="Top" 
     Height="Auto" 
     Width="Auto" 
     Stretch="Fill" 
     Opacity="1" 
     Data="M 9,250 C9,250 491,250 491,250 " 
     Stroke="#FFB4B4B4" 
     StrokeThickness="1"/>
       
   </igDP:XamDataCarousel.Resources>
   <igDP:XamDataCarousel.ViewSettings>
    <igWindows:CarouselViewSettings
     ItemPath="{DynamicResource HorizontalPath}"
     IsNavigatorVisible="True"
     ItemHorizontalScrollBarVisibility="Disabled"
     ItemVerticalScrollBarVisibility="Disabled"
     ReserveSpaceForReflections="False"      
              OpacityEffectStopDirection="UseItemPath"
              ScalingEffectStopDirection="UseItemPath"
              UseOpacity="True"
              ItemPathPadding="50,0,50,152"
              ItemPathPrefixPercent="0"
              ItemPathSuffixPercent="0.15"
              ItemSize="128,128"
     ItemsPerPage="20"
     ItemPathRenderBrush="#77000000"
     UseScaling="True"
     IsListContinuous="True"
     HeightInInfiniteContainers="200"
     WidthInInfiniteContainers="200"
     ItemPathHorizontalAlignment="Stretch"
     ItemPathVerticalAlignment="Stretch"
     ItemTransitionStyle="AdjustSizeAndOpacity"
     ShouldAnimateItemsOnListChange="True"
     AutoScaleItemContentsToFit="True"
     ItemPathAutoPad="False"
     ItemPathStretch="None">
     <igWindows:CarouselViewSettings.ItemPathRenderPen>
      <Pen DashCap="Round"/>
     </igWindows:CarouselViewSettings.ItemPathRenderPen>
      

                            <igWindows:CarouselViewSettings.OpacityEffectStops>
                                <igWindows:OpacityEffectStopCollection>
                                    <igWindows:OpacityEffectStop Value="0"/>
                                    <igWindows:OpacityEffectStop Offset="0.1"/>
                                    <igWindows:OpacityEffectStop Offset="0.6" Value="1"/>
                                    <igWindows:OpacityEffectStop Offset="1" Value="0.1"/>
                                </igWindows:OpacityEffectStopCollection>
                            </igWindows:CarouselViewSettings.OpacityEffectStops>
                            <igWindows:CarouselViewSettings.ScalingEffectStops>
                                <igWindows:ScalingEffectStopCollection>
                                    <igWindows:ScalingEffectStop Value="0"/>
                                    <igWindows:ScalingEffectStop Offset="0.45" Value="0.8"/>
                                    <igWindows:ScalingEffectStop Offset="0.55" Value="2"/>
                                    <igWindows:ScalingEffectStop Offset="0.65" Value="0.8"/>
                                    <igWindows:ScalingEffectStop Offset="1" Value="0.2"/>
                                </igWindows:ScalingEffectStopCollection>
                            </igWindows:CarouselViewSettings.ScalingEffectStops>

    </igWindows:CarouselViewSettings>
   </igDP:XamDataCarousel.ViewSettings>
   <igDP:XamDataCarousel.FieldSettings>
    <igDP:FieldSettings
     AllowEdit="False"
     AllowCellVirtualization="False"
     CellClickAction="SelectCell"
     LabelClickAction="SelectField"
     LabelTextAlignment="Center"
     LabelTextTrimming="None"
     LabelTextWrapping="Wrap"
     AllowRecordFiltering="False"
     AllowResize="True"
     AllowHiding="Always"
     AllowLabelVirtualization="False"
     AllowSummaries="False" CellContentAlignment="ValueOnly" />
   </igDP:XamDataCarousel.FieldSettings>
   <igDP:XamDataCarousel.FieldLayoutSettings>
    <igDP:FieldLayoutSettings
     AutoGenerateFields="True"
     AllowFieldMoving="No"
     AllowRecordFixing="No"
     AllowClipboardOperations="None"
     SelectionTypeCell="Single" AddNewRecordLocation="Default" AllowAddNew="True" AutoArrangeCells="LeftToRight" AutoFitMode="Always" LabelLocation="Hidden" HeaderPrefixAreaDisplayMode="None" ExpansionIndicatorDisplayMode="Never" FixedFieldUIType="None" FixedRecordUIType="Button" />
   </igDP:XamDataCarousel.FieldLayoutSettings>
  </igDP:XamDataCarousel>

if (e.TouchDevice != null && (productCarousel != null && e.TouchDevice.Captured == productCarousel

))

{

 

 

 

 

var lp = e.TouchDevice.GetTouchPoint(this).Position.X - pointFromLeft.X

;

 

 

 

 

var tp = e.TouchDevice.GetTouchPoint(this).Position.Y - pointFromLeft.Y

;

 

 

 

 

if (lp <

0)

{

 

 

 

 

if (productCarousel != null) productCarousel.ExecuteCommand(DataPresenterCommands.CellPrevious

);

 

 

 

 

//productCarousel.ExecuteCommand(DataPresenterCommands.CellLeft);

 

 

 

 

//productCarousel.ExecuteCommand(DataPresenterCommands.RecordPrevious);

}

 

 

 

 

else

{

 

 

 

 

//if (productCarousel != null)

 

 

 

 

// productCarousel.ExecuteCommand(XamCarouselPanelCommands.NavigateToNextItem);

 

 

 

 

if (productCarousel != null) productCarousel.ExecuteCommand(DataPresenterCommands.CellNext

);

 

 

 

 

//productCarousel.ExecuteCommand(DataPresenterCommands.CellRight);

 

 

 

 

//productCarousel.ExecuteCommand(DataPresenterCommands.RecordPrevious);

}

}

e

 

 

 

.Handled = true

;

Parents
No Data
Reply
  • 30945
    Offline posted

    Hello Darrell,

     

    I have been reading through your post and I have created a sample application for you, which demonstrates an approach for implementing scrolling on the items in the XamDataCarousel via touch. In order to implement the scrolling I have used the TouchMove event and in its event handler I am getting the XamCarouselPanel that is used in the XamDataCarousel and using the ExecuteCommnad method I am executing the NavigateToNextItem and  NavigateToPreviousItem commands in order to navigate through its items.

     

    Please let me know if you need any further assistance on the matter.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

    DataCarouselScrollOnTouch.zip
Children
No Data