SciChart WPF 2D Charts > Annotations API > The LineArrowAnnotation Type
The LineArrowAnnotation Type

The LineArrowAnnotation type draws a line with arrow head from X1Y1 to X2Y2, where coordinates are data-values.



Declaring a LineArrowAnnotation in XAML

Declaring a LineArrowAnnotation
Copy Code
<!-- Where xmlns:s="" -->
      <!-- Declares a LineArrowAnnotation at X1=1, X2=2, Y1=4, Y2=6 -->
         <!-- The annotation will move with the chart as you zoom and pan -->
      <s:LineArrowAnnotation Stroke="#555" StrokeThickness="2"
                              X1="1" X2="2" Y1="4" Y2="6"

Declaring a LineAnnotation in Code

Declaring a LineAnnotation
Copy Code
var sciChartSurface = new SciChartSurface();
sciChartSurface.Annotations.Add(new LineArrowAnnotation()
   Stroke = new SolidColorBrush(Colors.FromArgb(0xFF, 0x55, 0x55, 0x55)),
   StrokeThickness = 2,
   X1 = 1,
   X2 = 2,
   Y1 = 4,
   Y2 = 6,
   IsEditable = true,

Templating the LineArrowAnnotation

The Default Style and ControlTemplate for the LineArrowAnnotation is defined below. You shouldn’t need to change this, but if you want to template the annotation, here are the template parts:

Templating the LineArrowAnnotation
Copy Code
<Style BasedOn="{StaticResource AnnotationBaseStyle}" TargetType="a:LineArrowAnnotation">
   <Setter Property="Stroke" Value="{me:ThemeBinding RubberBandStrokeBrush}" />
   <Setter Property="StrokeThickness" Value="2.0" />
   <Setter Property="Template">
         <ControlTemplate TargetType="a:LineArrowAnnotation">
            <Grid x:Name="PART_LineArrowAnnotationRoot">
               <Line x:Name="PART_GhostLine"
                     Member=visuals:ManipulationMargins.AnnotationLineWidth}" />
               <Line x:Name="PART_Line"
                    Stroke="{TemplateBinding Stroke}"
                    StrokeDashArray="{TemplateBinding StrokeDashArray}"
                    StrokeThickness="{TemplateBinding StrokeThickness}" />
               <Polygon x:Name="PART_ArrowHead"
                      Fill="{TemplateBinding Stroke}"
                      Stroke="{TemplateBinding Stroke}"
                      StrokeThickness="{TemplateBinding StrokeThickness}" />