Pre loader

Vertical line annotation mvvm binding issue

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

0
0

Hi!

I am trying out a feature in my application with editable vertical lines annotations. My problem is that my set method needs to perform some calculations when the vertical line is moved, and since the set method is being called multiple times when moving the annotation, it slows it down and doesn’t give the user that great feeling that it should

Is there any way of delaying the set method being called until the user actually drops the annotation?

  • You must to post comments
0
0

Hello Lisbeth,

There aren’t other solutions for now, so please, find a template for the VerticalLineAnnotation here:

    <Style TargetType="SciChart:VerticalLineAnnotation">
        <Setter Property="LabelTextFormatting" Value="{Binding ParentSurface.XAxis.TextFormatting, RelativeSource={RelativeSource Self}}" />
        <Setter Property="LabelTextFormatting" Value="{Binding XAxis.TextFormatting, RelativeSource={RelativeSource Self}}" />
        <Setter Property="Stroke" Value="{StaticResource RubberBandStrokeBrush}" />
        <Setter Property="StrokeThickness" Value="2.0" />
        <Setter Property="LabelValue" Value="{Binding X1, RelativeSource={RelativeSource Self}}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="SciChart:VerticalLineAnnotation">
                    <Grid x:Name="PART_VerticalLineAnnotationRoot">
                        <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="11"
                              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}"
                              StrokeThickness="{TemplateBinding StrokeThickness}"
                              X1="0"
                              X2="0"
                              Y1="0"
                              Y2="1" />

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

You could modify it as described in posts I’ve pointed to. Please, let us know if you need further assistance with this.

Best regards,
Yuriy

  • 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