TrackerDefinition.cs 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // --------------------------------------------------------------------------------------------------------------------
  2. // <copyright file="TrackerDefinition.cs" company="OxyPlot">
  3. // Copyright (c) 2020 OxyPlot contributors
  4. // </copyright>
  5. // <summary>
  6. // Represents a tracker definition.
  7. // </summary>
  8. // --------------------------------------------------------------------------------------------------------------------
  9. namespace OxyPlot.Wpf
  10. {
  11. using System.Windows;
  12. using System.Windows.Controls;
  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="PlotViewBase" /> control.</remarks>
  19. public class TrackerDefinition : DependencyObject
  20. {
  21. /// <summary>
  22. /// Identifies the <see cref="TrackerKey"/> dependency property.
  23. /// </summary>
  24. public static readonly DependencyProperty TrackerKeyProperty = DependencyProperty.Register(
  25. nameof(TrackerKey), typeof(string), typeof(TrackerDefinition), new PropertyMetadata(null));
  26. /// <summary>
  27. /// Identifies the <see cref="TrackerTemplate"/> dependency property.
  28. /// </summary>
  29. public static readonly DependencyProperty TrackerTemplateProperty =
  30. DependencyProperty.Register(
  31. nameof(TrackerTemplate), typeof(ControlTemplate), typeof(TrackerDefinition), new PropertyMetadata(null));
  32. /// <summary>
  33. /// Gets or sets the tracker key.
  34. /// </summary>
  35. /// <remarks>The Plot will use this property to find the TrackerDefinition that matches the TrackerKey of the current series.</remarks>
  36. public string TrackerKey
  37. {
  38. get => (string)this.GetValue(TrackerKeyProperty);
  39. set => this.SetValue(TrackerKeyProperty, value);
  40. }
  41. /// <summary>
  42. /// Gets or sets the tracker template.
  43. /// </summary>
  44. /// <remarks>The tracker control will be added/removed from the Tracker overlay as necessary.
  45. /// The DataContext of the tracker will be set to a TrackerHitResult with the current tracker data.</remarks>
  46. public ControlTemplate TrackerTemplate
  47. {
  48. get => (ControlTemplate)this.GetValue(TrackerTemplateProperty);
  49. set => this.SetValue(TrackerTemplateProperty, value);
  50. }
  51. }
  52. }