Skip to content

Instantly share code, notes, and snippets.

@mecab
Created May 27, 2012 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mecab/2802533 to your computer and use it in GitHub Desktop.
Save mecab/2802533 to your computer and use it in GitHub Desktop.
Sample code of fixing strange slider behivor with GestureService
<phone:PhoneApplicationPage
x:Class="SliderWithGestureService.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:tookit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="True">
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="SLIDER WITH GS" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Slider Test" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<StackPanel>
<Slider Height="84" Name="strangeSlider" />
<Slider Height="84" Name="fixedSlider" ManipulationStarted="disableGestures" ManipulationCompleted="restoreGestures" />
</StackPanel>
<Rectangle Width="100" Height="100" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0" Name="rectangle1" Fill="Gray">
<Rectangle.Projection>
<PlaneProjection>
</PlaneProjection>
</Rectangle.Projection>
<Rectangle.RenderTransform>
<TranslateTransform x:Name="transform">
</TranslateTransform>
</Rectangle.RenderTransform>
<tookit:GestureService.GestureListener>
<tookit:GestureListener DragDelta="GestureListener_DragDelta" />
</tookit:GestureService.GestureListener>
</Rectangle>
</Grid>
</Grid>
</phone:PhoneApplicationPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment