none
Panorama中加入了一个轮播图片,无法左右滑动,总是出发Panorama的左右滑动事件 RRS feed

  • 问题

  • 我无法在Panorama很好地加入手势事件

    我的xaml code

                        <Grid Grid.Row="0" Margin="0,0,0,427">
                            <Image Name="imageTop"
                                   Canvas.Top="0"
                                   Width="420"
                                   Height="179"
                                   VerticalAlignment="Top"
                                   Source="{Binding ImageSource}"
                                   Stretch="Fill"
                                   Tap="imageTop_Tap">
                                
                                    <toolkit:GestureService.GestureListener>
                                    <toolkit:GestureListener Flick="pictureFlick" />
                                    </toolkit:GestureService.GestureListener>
                                
                            </Image>
                            <TextBlock Name="txtid"
                                       Text="{Binding Param}"
                                       Visibility="Collapsed" />
                            <Border Name="border7"
                                    Canvas.Top="160"
                                    Width="420"
                                    Height="30"
                                    Margin="0,149,0,0"
                                    Background="Gainsboro"
                                    BorderBrush="Silver"
                                    BorderThickness="1"
                                    Opacity="0.5">
                                <Grid>
                                    <TextBlock Name="titleTextBlock"
                                               Width="300"
                                               Margin="10,0,0,0"
                                               HorizontalAlignment="Left"
                                               FontSize=" 20"
                                               Foreground="Red"
                                               Text="{Binding Title}" />
    
                                    <Border Name="border1"
                                            Width="14"
                                            Height="14"
                                            Margin="320,10,0,0"
                                            HorizontalAlignment="Left"
                                            VerticalAlignment="Top"
                                            Background="{Binding BorderBack1}"
                                            BorderBrush="Silver"
                                            CornerRadius="90,90,90,90" />
                                    <Border Name="border2"
                                            Width="14"
                                            Height="14"
                                            Margin="340,10,0,0"
                                            HorizontalAlignment="Left"
                                            VerticalAlignment="Top"
                                            Background="{Binding BorderBack2}"
                                            BorderBrush="Silver"
                                            CornerRadius="90,90,90,90" />
                                    <Border Name="border3"
                                            Width="14"
                                            Height="14"
                                            Margin="360,10,0,0"
                                            HorizontalAlignment="Left"
                                            VerticalAlignment="Top"
                                            Background="{Binding BorderBack3}"
                                            BorderBrush="Silver"
                                            CornerRadius="90,90,90,90" />
                                    <Border Name="border4"
                                            Width="14"
                                            Height="14"
                                            Margin="380,10,0,0"
                                            HorizontalAlignment="Left"
                                            VerticalAlignment="Top"
                                            Background="{Binding BorderBack4}"
                                            BorderBrush="Silver"
                                            CornerRadius="90,90,90,90" />
                                </Grid>
                            </Border>
    
                        </Grid>

    我的behind code

            #region 轮播位
            private void imageTop_Tap(object sender, GestureEventArgs e)
            {
                string b = txtid.Text;
            }
    
            private void ImageTop_OnManipulationCompleted(object sender, ManipulationCompletedEventArgs e)
            {
                //panorama.IsHitTestVisible = true;
            }
    
            private void ImageTop_OnManipulationStarted(object sender, ManipulationStartedEventArgs e)
            {
                panorama.IsHitTestVisible = false;
                e.Handled = true;
            }
    
            private void ImageTop_OnManipulationDelta(object sender, ManipulationDeltaEventArgs e)
            {
    
                panorama.IsHitTestVisible = false;
                e.Handled = true;
            }
    
    
            private void pictureFlick(object sender, FlickGestureEventArgs e)
            {
                if (e.Angle > 135 && e.Angle < 225) //手指向左滑动
                {
                    topPicture.Left();
                    panorama.IsHitTestVisible = true;
               }
                else if (e.Angle > 315 || e.Angle < 45) //手指向右滑动
                {
                    topPicture.Right();
                    panorama.IsHitTestVisible = true;
                }
            }
            #endregion

    请教:)

    2013年10月24日 2:49

答案

全部回复