Note that there are some explanatory texts on larger screens.

plurals
  1. POTouchable area around control
    primarykey
    data
    text
    <p>Some controls in Windows Phone 7 have touchable area around, if you touch not exactly in control, but in this area, the event is still raising from the control (I don't know how to name this area correctly, but can show it in screenshot). I have a custom slider with range selection ability, but it's too hard to touch to the slider thumb and move it. Increasing a thumb is undesireable. How can I add touchable area to slider thumbs to ease positioning of them? Here is a XAML of slider:</p> <pre><code>&lt;Style TargetType="local:RangeSlider"&gt; &lt;Setter Property="BorderThickness" Value="1" /&gt; &lt;Setter Property="BorderBrush" Value="Black" /&gt; &lt;Setter Property="Background" Value="Black" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="local:RangeSlider"&gt; &lt;Border Padding="{TemplateBinding Padding}" &gt; &lt;Grid&gt; &lt;Rectangle Fill="#FFCCCCCC" VerticalAlignment="Center" Margin="2.5,0,2.5,0" Height="12" StrokeThickness="0" /&gt; &lt;Border x:Name="SelectedRangeBorder" Margin="0" Height="12"&gt; &lt;Grid&gt; &lt;Grid.Resources&gt; &lt;Style x:Key="EndThumbStyle" TargetType="Thumb"&gt; &lt;Setter Property="Background" Value="Black"/&gt; &lt;Setter Property="BorderThickness" Value="1"/&gt; &lt;Setter Property="IsTabStop" Value="False"/&gt; &lt;Setter Property="BorderBrush"&gt; &lt;Setter.Value&gt; &lt;LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"&gt; &lt;GradientStop Color="#FFCD0000" Offset="0"/&gt; &lt;GradientStop Color="#FFCD0000" Offset="0.375"/&gt; &lt;GradientStop Color="#FFCD0000" Offset="0.375"/&gt; &lt;GradientStop Color="#FFCD0000" Offset="1"/&gt; &lt;/LinearGradientBrush&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="Thumb"&gt; &lt;Grid Background="Black" Width="12" Height="12" Margin="-3,-4,-5,-4"&gt; &lt;VisualStateManager.VisualStateGroups&gt; &lt;VisualStateGroup x:Name="CommonStates"&gt; &lt;VisualState x:Name="Normal"/&gt; &lt;VisualState x:Name="MouseOver"&gt; &lt;Storyboard&gt; &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity"&gt; &lt;SplineDoubleKeyFrame KeyTime="0" Value="1"/&gt; &lt;/DoubleAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;VisualState x:Name="Pressed"&gt; &lt;Storyboard&gt; &lt;ColorAnimationUsingKeyFrames Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"&gt; &lt;SplineColorKeyFrame KeyTime="0" Value="Red"/&gt; &lt;/ColorAnimationUsingKeyFrames&gt; &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity"&gt; &lt;SplineDoubleKeyFrame KeyTime="0" Value="1"/&gt; &lt;/DoubleAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;VisualState x:Name="Disabled"&gt; &lt;Storyboard&gt; &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="Opacity"&gt; &lt;SplineDoubleKeyFrame KeyTime="0" Value=".55"/&gt; &lt;/DoubleAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;/VisualStateGroup&gt; &lt;VisualStateGroup x:Name="FocusStates"&gt; &lt;VisualState x:Name="Focused"&gt; &lt;Storyboard&gt; &lt;DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity"&gt; &lt;SplineDoubleKeyFrame KeyTime="0" Value="1"/&gt; &lt;/DoubleAnimationUsingKeyFrames&gt; &lt;/Storyboard&gt; &lt;/VisualState&gt; &lt;VisualState x:Name="Unfocused"/&gt; &lt;/VisualStateGroup&gt; &lt;/VisualStateManager.VisualStateGroups&gt; &lt;Border x:Name="Background" Background="#FFCCCCCC" BorderBrush="{TemplateBinding BorderBrush}" Width="12" Height="12"&gt; &lt;Grid Margin="0" Width="12" Height="12" d:IsHidden="True"&gt; &lt;Border x:Name="BackgroundAnimation" Opacity="0" Background="Black"/&gt; &lt;Rectangle x:Name="BackgroundGradient" StrokeThickness="0" Fill="Black"/&gt; &lt;/Grid&gt; &lt;/Border&gt; &lt;Rectangle x:Name="DisabledVisualElement" Fill="Black" IsHitTestVisible="false" Opacity="0" Margin="0" StrokeThickness="0" Width="12" Height="12"/&gt; &lt;Rectangle x:Name="FocusVisualElement" Stroke="#FFCCCCCC" StrokeThickness="0" Margin="0" IsHitTestVisible="false" Opacity="0" Width="12" Height="12"/&gt; &lt;StackPanel Orientation="Horizontal" Margin="0" MaxHeight="10" Width="12" Height="12"&gt; &lt;Rectangle Width="12" Fill="Black" Height="12" StrokeThickness="0" Margin="0" HorizontalAlignment="Left" VerticalAlignment="Top"/&gt; &lt;Rectangle Fill="Black" Width="12" Margin="1,-5,0,0" Height="12" HorizontalAlignment="Left" VerticalAlignment="Top"/&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/Grid.Resources&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="Auto" /&gt; &lt;ColumnDefinition Width="*" /&gt; &lt;ColumnDefinition Width="Auto" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Thumb x:Name="RangeCenterThumb" Grid.Column="1" Cursor="Hand" Margin="0" BorderThickness="0" Width="Auto" Height="12" Foreground="#FFCD0000" Background="#FFCD0000" &gt; &lt;Thumb.Style&gt; &lt;Style TargetType="Thumb"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="Thumb"&gt; &lt;Grid Background="#FFCD0000" Height="12"&gt; &lt;Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" /&gt; &lt;/Grid&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/Thumb.Style&gt; &lt;/Thumb&gt; &lt;Thumb x:Name="RangeStartThumb" Cursor="SizeWE" Width="12" Style="{StaticResource EndThumbStyle}" BorderThickness="{TemplateBinding BorderThickness}" Height="12" Foreground="Black" Background="Black" BorderBrush="Black" /&gt; &lt;Thumb x:Name="RangeEndThumb" Grid.Column="2" Cursor="SizeWE" Width="12" Style="{StaticResource EndThumbStyle}" BorderBrush="Black" Height="12" Foreground="Black" BorderThickness="0" /&gt; &lt;/Grid&gt; &lt;/Border&gt; &lt;/Grid&gt; &lt;/Border&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload