DataPointExtension.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <copyright file="DataPointExtension.cs" company="OxyPlot">
  3. // Copyright (c) 2014 OxyPlot contributors
  4. // </copyright>
  5. // <summary>
  6. // Provides a markup extension for DataPoints.
  7. // </summary>
  8. // --------------------------------------------------------------------------------------------------------------------
  9. using Avalonia.Markup.Xaml;
  10. using System;
  11. namespace OxyPlot.Avalonia
  12. {
  13. /// <summary>
  14. /// Provides a markup extension for <see cref="DataPoint" />s.
  15. /// </summary>
  16. public class DataPointExtension : MarkupExtension
  17. {
  18. /// <summary>
  19. /// The point
  20. /// </summary>
  21. private readonly DataPoint point;
  22. /// <summary>
  23. /// Initializes a new instance of the <see cref="DataPointExtension"/> class.
  24. /// </summary>
  25. /// <param name="x">The x-coordinate.</param>
  26. /// <param name="y">The y-coordinate.</param>
  27. public DataPointExtension(double x, double y)
  28. {
  29. point = new DataPoint(x, y);
  30. }
  31. public override object ProvideValue(IServiceProvider serviceProvider)
  32. {
  33. return point;
  34. }
  35. }
  36. }