Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
797882a6aThis file is pinned to the selected release. Download the original to open it in your design tool.
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ShapeAnnotation.cs" company="OxyPlot">
// Copyright (c) 2014 OxyPlot contributors
// </copyright>
// <summary>
// Provides an abstract base class for shape annotations.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace OxyPlot.Wpf
{
using System.Windows;
using System.Windows.Media;
/// <summary>
/// Provides an abstract base class for shape annotations.
/// </summary>
public abstract class ShapeAnnotation : TextualAnnotation
{
/// <summary>
/// Identifies the <see cref="Fill"/> dependency property.
/// </summary>
public static readonly DependencyProperty FillProperty = DependencyProperty.Register(
"Fill",
typeof(Color),
typeof(ShapeAnnotation),
new PropertyMetadata(Colors.LightBlue, AppearanceChanged));
/// <summary>
/// Identifies the <see cref="Stroke"/> dependency property.
/// </summary>
public static readonly DependencyProperty StrokeProperty = DependencyProperty.Register(
"Stroke",
typeof(Color),
typeof(ShapeAnnotation),
new PropertyMetadata(Colors.Black, AppearanceChanged));
/// <summary>
/// Identifies the <see cref="StrokeThickness"/> dependency property.
/// </summary>
public static readonly DependencyProperty StrokeThicknessProperty = DependencyProperty.Register(
"StrokeThickness",
typeof(double),
typeof(ShapeAnnotation),
new PropertyMetadata(0.0, AppearanceChanged));
/// <summary>
/// Gets or sets the fill color.
/// </summary>
public Color Fill
{
get
{
return (Color)this.GetValue(FillProperty);
}
set
{
this.SetValue(FillProperty, value);
}
}
/// <summary>
/// Gets or sets the stroke color.
/// </summary>
public Color Stroke
{
get
{
return (Color)this.GetValue(StrokeProperty);
}
set
{
this.SetValue(StrokeProperty, value);
}
}
/// <summary>
/// Gets or sets the stroke thickness.
/// </summary>
public double StrokeThickness
{
get
{
return (double)this.GetValue(StrokeThicknessProperty);
}
set
{
this.SetValue(StrokeThicknessProperty, value);
}
}
/// <summary>
/// Synchronizes the properties.
/// </summary>
public override void SynchronizeProperties()
{
base.SynchronizeProperties();
var a = (Annotations.ShapeAnnotation)this.InternalAnnotation;
a.Fill = this.Fill.ToOxyColor();
a.Stroke = this.Stroke.ToOxyColor();
a.StrokeThickness = this.StrokeThickness;
}
}
}