TrackerDefinition.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <copyright file="TrackerDefinition.cs" company="OxyPlot">
  3. // Copyright (c) 2014 OxyPlot contributors
  4. // </copyright>
  5. // <summary>
  6. // Represents a tracker definition.
  7. // </summary>
  8. // --------------------------------------------------------------------------------------------------------------------
  9. using Avalonia;
  10. using Avalonia.Markup.Xaml.Templates;
  11. namespace OxyPlot.Avalonia
  12. {
  13. /// <summary>
  14. /// Represents a tracker definition.
  15. /// </summary>
  16. /// <remarks>The tracker definitions make it possible to show different trackers for different series.
  17. /// The <see cref="OxyPlot.Series.Series.TrackerKey" /> property is matched with the <see cref="TrackerDefinition.TrackerKey" />
  18. /// in the TrackerDefinitions collection in the <see cref="PlotView" /> control.</remarks>
  19. public class TrackerDefinition : AvaloniaObject
  20. {
  21. /// <summary>
  22. /// Identifies the <see cref="TrackerKey"/> dependency property.
  23. /// </summary>
  24. public static readonly StyledProperty<string> TrackerKeyProperty = AvaloniaProperty.Register<TrackerDefinition, string>(nameof(TrackerKey));
  25. /// <summary>
  26. /// Identifies the <see cref="TrackerTemplate"/> dependency property.
  27. /// </summary>
  28. public static readonly StyledProperty<ControlTemplate> TrackerTemplateProperty = AvaloniaProperty.Register<TrackerDefinition, ControlTemplate>(nameof(TrackerTemplate));
  29. /// <summary>
  30. /// Gets or sets the tracker key.
  31. /// </summary>
  32. /// <remarks>The Plot will use this property to find the TrackerDefinition that matches the TrackerKey of the current series.</remarks>
  33. public string TrackerKey
  34. {
  35. get
  36. {
  37. return GetValue(TrackerKeyProperty);
  38. }
  39. set
  40. {
  41. SetValue(TrackerKeyProperty, value);
  42. }
  43. }
  44. /// <summary>
  45. /// Gets or sets the tracker template.
  46. /// </summary>
  47. /// <remarks>The tracker control will be added/removed from the Tracker overlay as necessary.
  48. /// The DataContext of the tracker will be set to a TrackerHitResult with the current tracker data.</remarks>
  49. public ControlTemplate TrackerTemplate
  50. {
  51. get
  52. {
  53. return GetValue(TrackerTemplateProperty);
  54. }
  55. set
  56. {
  57. SetValue(TrackerTemplateProperty, value);
  58. }
  59. }
  60. }
  61. }