// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) 2014 OxyPlot contributors
//
//
// Provides an abstract base class for shape annotations.
//
// --------------------------------------------------------------------------------------------------------------------
using Avalonia;
namespace OxyPlot.Avalonia
{
using global::Avalonia.Media;
///
/// Provides an abstract base class for shape annotations.
///
public abstract class ShapeAnnotation : TextualAnnotation
{
///
/// Identifies the dependency property.
///
public static readonly StyledProperty FillProperty = AvaloniaProperty.Register(nameof(Fill), Colors.LightBlue);
///
/// Identifies the dependency property.
///
public static readonly StyledProperty StrokeProperty = AvaloniaProperty.Register(nameof(Stroke), Colors.Black);
///
/// Identifies the dependency property.
///
public static readonly StyledProperty StrokeThicknessProperty = AvaloniaProperty.Register(nameof(StrokeThickness), 0.0);
///
/// Gets or sets the fill color.
///
public Color Fill
{
get
{
return GetValue(FillProperty);
}
set
{
SetValue(FillProperty, value);
}
}
///
/// Gets or sets the stroke color.
///
public Color Stroke
{
get
{
return GetValue(StrokeProperty);
}
set
{
SetValue(StrokeProperty, value);
}
}
///
/// Gets or sets the stroke thickness.
///
public double StrokeThickness
{
get
{
return GetValue(StrokeThicknessProperty);
}
set
{
SetValue(StrokeThicknessProperty, value);
}
}
///
/// Synchronizes the properties.
///
public override void SynchronizeProperties()
{
base.SynchronizeProperties();
var a = (Annotations.ShapeAnnotation)InternalAnnotation;
a.Fill = Fill.ToOxyColor();
a.Stroke = Stroke.ToOxyColor();
a.StrokeThickness = StrokeThickness;
}
static ShapeAnnotation()
{
FillProperty.Changed.AddClassHandler(AppearanceChanged);
StrokeProperty.Changed.AddClassHandler(AppearanceChanged);
StrokeThicknessProperty.Changed.AddClassHandler(AppearanceChanged);
}
}
}