// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) 2014 OxyPlot contributors
//
//
// This is a Avalonia wrapper of OxyPlot.EllipseAnnotation
//
// --------------------------------------------------------------------------------------------------------------------
using Avalonia;
namespace OxyPlot.Avalonia
{
///
/// This is a Avalonia wrapper of OxyPlot.EllipseAnnotation
///
public class EllipseAnnotation : ShapeAnnotation
{
///
/// Identifies the dependency property.
///
public static readonly StyledProperty XProperty = AvaloniaProperty.Register(nameof(X), 0.0);
///
/// Identifies the dependency property.
///
public static readonly StyledProperty YProperty = AvaloniaProperty.Register(nameof(Y), 0.0);
///
/// Initializes static members of the class.
///
static EllipseAnnotation()
{
TextColorProperty.OverrideDefaultValue(MoreColors.Automatic);
TextColorProperty.Changed.AddClassHandler(AppearanceChanged);
XProperty.Changed.AddClassHandler(DataChanged);
YProperty.Changed.AddClassHandler(DataChanged);
WidthProperty.Changed.AddClassHandler(DataChanged);
HeightProperty.Changed.AddClassHandler(DataChanged);
}
///
/// Initializes a new instance of the class.
///
public EllipseAnnotation()
{
InternalAnnotation = new Annotations.EllipseAnnotation();
}
///
/// Gets or sets the X.
///
public double X
{
get
{
return GetValue(XProperty);
}
set
{
SetValue(XProperty, value);
}
}
///
/// Gets or sets the Y.
///
public double Y
{
get
{
return GetValue(YProperty);
}
set
{
SetValue(YProperty, value);
}
}
///
/// Creates the internal annotation object.
///
/// The annotation.
public override Annotations.Annotation CreateModel()
{
SynchronizeProperties();
return InternalAnnotation;
}
///
/// Synchronizes the properties.
///
public override void SynchronizeProperties()
{
base.SynchronizeProperties();
var a = (Annotations.EllipseAnnotation)InternalAnnotation;
a.X = X;
a.Width = Width;
a.Y = Y;
a.Height = Height;
}
}
}