PageRenderTime 23ms CodeModel.GetById 11ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 1ms

/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//===================================================================================
 17using System.Windows.Controls;
 18using System.Windows;
 19using System.Windows.Data;
 20using System;
 21using System.Collections;
 22using System.Collections.ObjectModel;
 23
 24
 25namespace StockTraderRI.ChartControls
 26{
 27    public class ContinuousAxis : ItemsControl
 28    {
 29        static ContinuousAxis()
 30        {
 31            DefaultStyleKeyProperty.OverrideMetadata(typeof(ContinuousAxis), new FrameworkPropertyMetadata(typeof(ContinuousAxis)));
 32        }
 33
 34        protected override DependencyObject GetContainerForItemOverride()
 35        {
 36            return new ContentControl();
 37        }
 38
 39        protected override bool IsItemItsOwnContainerOverride(object item)
 40        {
 41            return item is ContentControl;
 42        }
 43
 44      
 45        public ObservableCollection<double> SourceValues
 46        {
 47            get { return (ObservableCollection<double>)GetValue(SourceValuesProperty); }
 48            set { SetValue(SourceValuesProperty, value); }
 49        }
 50
 51        // Using a DependencyProperty as the backing store for SourceValues.  This enables animation, styling, binding, etc...
 52        public static readonly DependencyProperty SourceValuesProperty =
 53            DependencyProperty.Register("SourceValues", typeof(ObservableCollection<double>), typeof(ContinuousAxis), new UIPropertyMetadata(null));
 54
 55
 56        public ObservableCollection<double> Values
 57        {
 58            get { return (ObservableCollection<double>)GetValue(ValuesProperty); }
 59            set { SetValue(ValuesProperty, value); }
 60        }
 61
 62        // Using a DependencyProperty as the backing store for Values.  This enables animation, styling, binding, etc...
 63        public static readonly DependencyProperty ValuesProperty =
 64            DependencyProperty.Register("Values", typeof(ObservableCollection<double>), typeof(ContinuousAxis), new UIPropertyMetadata(new ObservableCollection<double>()));
 65
 66
 67        public ObservableCollection<double> TickPositions
 68        {
 69            get { return (ObservableCollection<double>)GetValue(TickPositionsProperty); }
 70            set { SetValue(TickPositionsProperty, value); }
 71        }
 72
 73        // Using a DependencyProperty as the backing store for TickPositions.  This enables animation, styling, binding, etc...
 74        public static readonly DependencyProperty TickPositionsProperty =
 75            DependencyProperty.Register("TickPositions", typeof(ObservableCollection<double>), typeof(ContinuousAxis), new UIPropertyMetadata(null));
 76
 77
 78        public double Origin
 79        {
 80            get { return (double)GetValue(OriginProperty); }
 81            set { SetValue(OriginProperty, value); }
 82        }
 83
 84        // Using a DependencyProperty as the backing store for ZeroReferenceLinePosition.  This enables animation, styling, binding, etc...
 85        public static readonly DependencyProperty OriginProperty =
 86            DependencyProperty.Register("Origin", typeof(double), typeof(ContinuousAxis), new UIPropertyMetadata(0.0));
 87
 88
 89
 90        public Orientation Orientation
 91        {
 92            get { return (Orientation)GetValue(OrientationProperty); }
 93            set { SetValue(OrientationProperty, value); }
 94        }
 95
 96        // Using a DependencyProperty as the backing store for Orientation.  This enables animation, styling, binding, etc...
 97        public static readonly DependencyProperty OrientationProperty =
 98            DependencyProperty.Register("Orientation", typeof(Orientation), typeof(ContinuousAxis), new UIPropertyMetadata(Orientation.Vertical));
 99
100
101
102        public double ReferenceLineSeperation
103        {
104            get { return (double)GetValue(ReferenceLineSeperationProperty); }
105            set { SetValue(ReferenceLineSeperationProperty, value); }
106        }
107
108        // Using a DependencyProperty as the backing store for ReferenceLineSeperation.  This enables animation, styling, binding, etc...
109        public static readonly DependencyProperty ReferenceLineSeperationProperty =
110            DependencyProperty.Register("ReferenceLineSeperation", typeof(double), typeof(ContinuousAxis), new UIPropertyMetadata(null));
111
112
113
114    }
115}