Hi,
is it possible to make the Touch Area of a SliceModifiers’ LineAnnotation bigger?
Right now the area has the same size as the MouseClick area, which is a bit too small if you want to drag a modifier with your finger.
Maybe I didn’t look hard enough, but I couldn’t find an overridable HitTest Method in VerticalSliceModifier/VerticalSliceModifierBase.
Or is it possible to override a HitTest (like the “IsPointWithinBounds()” method?) in the LineAnnotation class and use this custom VerticalLineAnnotation as my VerticalLine?
Thank you very much!
Regards,
dowe
- dowe asked 8 years ago
- You must login to post comments
You know I think you can achieve this by templating the VerticalLineAnnotation.
Here’s the template from the VerticalLineAnnotation Documentation:
<Style BasedOn="{StaticResource AnnotationBaseStyle}" TargetType="a:VerticalLineAnnotation">
<Setter Property="Stroke" Value="{me:ThemeBinding RubberBandStrokeBrush}" />
<Setter Property="StrokeThickness" Value="2" />
<Setter Property="LabelTextFormatting" Value="{Binding DefaultTextFormatting, Mode=OneWay, RelativeSource={RelativeSource Self}}" />
<Setter Property="LabelValue" Value="{Binding DefaultLabelValue, Converter={StaticResource IComparableToObject}, Mode=OneWay, RelativeSource={RelativeSource Self}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="a:VerticalLineAnnotation">
<Grid x:Name="PART_LineAnnotationRoot" ShowGridLines="False">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Line x:Name="PART_GhostLine"
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="Center"
Stretch="Fill"
Stroke="Transparent"
StrokeThickness="{s:Static Member=visuals:ManipulationMargins.AnnotationLineWidth}"
X1="0"
X2="0"
Y1="0"
Y2="1" />
<Line x:Name="PART_Line"
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="Center"
Stretch="Fill"
Stroke="{TemplateBinding Stroke}"
StrokeDashArray="{TemplateBinding StrokeDashArray}"
StrokeEndLineCap="Square"
StrokeStartLineCap="Square"
StrokeThickness="{TemplateBinding StrokeThickness}"
X1="0"
X2="0"
Y1="0"
Y2="1" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
You will notice the part PART_GhostLine. This is a transparent line, behind the actual line, which is used for Hit-Testing (basically its slightly wider than the line to make it easier to click).
In fact, you don’t even need to template the VerticalLineAnnotation! Simply change the value of the global static property ManipulationMargins.AnnotationLineWidth.
e.g.
ManipulationMargins.AnnotationLineWidth = 10.0; // or 20
Try that. It should work!
Best regards,
Andrew
- Andrew Burnett-Thompson answered 8 years ago
-
Perfect! Exactly what I was looking for. Thanks!
- You must login to post comments
Please login first to submit.