Pre loader

VerticalSliceModifier Touch Area

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

Answered
1
0

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

  • You must to post comments
Best Answer
0
0

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

  • dowe
    Perfect! Exactly what I was looking for. Thanks!
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies