PageRenderTime 44ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/Main/src/DynamicDataDisplay/PointMarkers/CircleElementPointMarker.cs

#
C# | 50 lines | 43 code | 6 blank | 1 comment | 2 complexity | ee46c556048ee413e7133fbb719b982d MD5 | raw file
Possible License(s): CC-BY-SA-3.0
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. using System.Windows.Shapes;
  5. namespace Microsoft.Research.DynamicDataDisplay.PointMarkers
  6. {
  7. /// <summary>Adds Circle element at every point of graph</summary>
  8. public class CircleElementPointMarker : ShapeElementPointMarker {
  9. public override UIElement CreateMarker()
  10. {
  11. Ellipse result = new Ellipse();
  12. result.Width = Size;
  13. result.Height = Size;
  14. result.Stroke = Brush;
  15. result.Fill = Fill;
  16. if (!String.IsNullOrEmpty(ToolTipText))
  17. {
  18. ToolTip tt = new ToolTip();
  19. tt.Content = ToolTipText;
  20. result.ToolTip = tt;
  21. }
  22. return result;
  23. }
  24. public override void SetMarkerProperties(UIElement marker)
  25. {
  26. Ellipse ellipse = (Ellipse)marker;
  27. ellipse.Width = Size;
  28. ellipse.Height = Size;
  29. ellipse.Stroke = Brush;
  30. ellipse.Fill = Fill;
  31. if (!String.IsNullOrEmpty(ToolTipText))
  32. {
  33. ToolTip tt = new ToolTip();
  34. tt.Content = ToolTipText;
  35. ellipse.ToolTip = tt;
  36. }
  37. }
  38. public override void SetPosition(UIElement marker, Point screenPoint)
  39. {
  40. Canvas.SetLeft(marker, screenPoint.X - Size / 2);
  41. Canvas.SetTop(marker, screenPoint.Y - Size / 2);
  42. }
  43. }
  44. }