PageRenderTime 43ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/V4/ChartControls/ContinuousAxis.cs

#
C# | 115 lines | 66 code | 27 blank | 22 comment | 0 complexity | 6f044d4d233c4b5fab2b581182505be3 MD5 | raw file
  1. //===================================================================================
  2. // Microsoft patterns & practices
  3. // Composite Application Guidance for Windows Presentation Foundation and Silverlight
  4. //===================================================================================
  5. // Copyright (c) Microsoft Corporation. All rights reserved.
  6. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
  7. // OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
  8. // LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  9. // FITNESS FOR A PARTICULAR PURPOSE.
  10. //===================================================================================
  11. // The example companies, organizations, products, domain names,
  12. // e-mail addresses, logos, people, places, and events depicted
  13. // herein are fictitious. No association with any real company,
  14. // organization, product, domain name, email address, logo, person,
  15. // places, or events is intended or should be inferred.
  16. //===================================================================================
  17. using System.Windows.Controls;
  18. using System.Windows;
  19. using System.Windows.Data;
  20. using System;
  21. using System.Collections;
  22. using System.Collections.ObjectModel;
  23. namespace StockTraderRI.ChartControls
  24. {
  25. public class ContinuousAxis : ItemsControl
  26. {
  27. static ContinuousAxis()
  28. {
  29. DefaultStyleKeyProperty.OverrideMetadata(typeof(ContinuousAxis), new FrameworkPropertyMetadata(typeof(ContinuousAxis)));
  30. }
  31. protected override DependencyObject GetContainerForItemOverride()
  32. {
  33. return new ContentControl();
  34. }
  35. protected override bool IsItemItsOwnContainerOverride(object item)
  36. {
  37. return item is ContentControl;
  38. }
  39. public ObservableCollection<double> SourceValues
  40. {
  41. get { return (ObservableCollection<double>)GetValue(SourceValuesProperty); }
  42. set { SetValue(SourceValuesProperty, value); }
  43. }
  44. // Using a DependencyProperty as the backing store for SourceValues. This enables animation, styling, binding, etc...
  45. public static readonly DependencyProperty SourceValuesProperty =
  46. DependencyProperty.Register("SourceValues", typeof(ObservableCollection<double>), typeof(ContinuousAxis), new UIPropertyMetadata(null));
  47. public ObservableCollection<double> Values
  48. {
  49. get { return (ObservableCollection<double>)GetValue(ValuesProperty); }
  50. set { SetValue(ValuesProperty, value); }
  51. }
  52. // Using a DependencyProperty as the backing store for Values. This enables animation, styling, binding, etc...
  53. public static readonly DependencyProperty ValuesProperty =
  54. DependencyProperty.Register("Values", typeof(ObservableCollection<double>), typeof(ContinuousAxis), new UIPropertyMetadata(new ObservableCollection<double>()));
  55. public ObservableCollection<double> TickPositions
  56. {
  57. get { return (ObservableCollection<double>)GetValue(TickPositionsProperty); }
  58. set { SetValue(TickPositionsProperty, value); }
  59. }
  60. // Using a DependencyProperty as the backing store for TickPositions. This enables animation, styling, binding, etc...
  61. public static readonly DependencyProperty TickPositionsProperty =
  62. DependencyProperty.Register("TickPositions", typeof(ObservableCollection<double>), typeof(ContinuousAxis), new UIPropertyMetadata(null));
  63. public double Origin
  64. {
  65. get { return (double)GetValue(OriginProperty); }
  66. set { SetValue(OriginProperty, value); }
  67. }
  68. // Using a DependencyProperty as the backing store for ZeroReferenceLinePosition. This enables animation, styling, binding, etc...
  69. public static readonly DependencyProperty OriginProperty =
  70. DependencyProperty.Register("Origin", typeof(double), typeof(ContinuousAxis), new UIPropertyMetadata(0.0));
  71. public Orientation Orientation
  72. {
  73. get { return (Orientation)GetValue(OrientationProperty); }
  74. set { SetValue(OrientationProperty, value); }
  75. }
  76. // Using a DependencyProperty as the backing store for Orientation. This enables animation, styling, binding, etc...
  77. public static readonly DependencyProperty OrientationProperty =
  78. DependencyProperty.Register("Orientation", typeof(Orientation), typeof(ContinuousAxis), new UIPropertyMetadata(Orientation.Vertical));
  79. public double ReferenceLineSeperation
  80. {
  81. get { return (double)GetValue(ReferenceLineSeperationProperty); }
  82. set { SetValue(ReferenceLineSeperationProperty, value); }
  83. }
  84. // Using a DependencyProperty as the backing store for ReferenceLineSeperation. This enables animation, styling, binding, etc...
  85. public static readonly DependencyProperty ReferenceLineSeperationProperty =
  86. DependencyProperty.Register("ReferenceLineSeperation", typeof(double), typeof(ContinuousAxis), new UIPropertyMetadata(null));
  87. }
  88. }