Example #1
0
        /// <summary>
        /// Finds object in control's template by it's name.
        /// </summary>
        /// <param name="name">Objects name.</param>
        /// <param name="templatedParent">Templated parent.</param>
        /// <returns>Object reference if found, null otherwise.</returns>
        public static object TemplateFindName(string name, FrameworkElement templatedParent)
        {
#if SILVERLIGHT
            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(templatedParent); i++)
            {
                DependencyObject child = VisualTreeHelper.GetChild(templatedParent, i);
                if (child is FrameworkElement)
                {
                    if (((FrameworkElement)child).Name == name)
                    {
                        return(child);
                    }
                    else
                    {
                        object subChild = TreeHelper.TemplateFindName(name, (FrameworkElement)child);
                        if (subChild != null && subChild is FrameworkElement && ((FrameworkElement)subChild).Name == name)
                        {
                            return(subChild);
                        }
                    }
                }
            }
            return(null);
#else
            return(((Control)templatedParent).Template.FindName(name, templatedParent));
#endif
        }
Example #2
0
        private void AssignLegend()
        {
            _legend = (Legend)TreeHelper.TemplateFindName("PART_Legend", this);
            _legend.LegendItemsSource = this.Graphs.Cast <ILegendItem>(); // TODO: handle changes in Graphs
#if WINDOWS_PHONE
            _legend.ManipulationStarted += new EventHandler <ManipulationStartedEventArgs>(OnGridManipulationStarted);
#endif
        }
Example #3
0
        private void AssignGraphCanvas()
        {
            _graphCanvasDecorator              = (Border)TreeHelper.TemplateFindName("PART_GraphCanvasDecorator", this);
            _graphCanvasDecorator.SizeChanged += new SizeChangedEventHandler(OnGraphCanvasDecoratorSizeChanged);
            _graphCanvas = (Canvas)TreeHelper.TemplateFindName("PART_GraphCanvas", this);

#if WINDOWS_PHONE
            _graphCanvas.ManipulationStarted += new EventHandler <ManipulationStartedEventArgs>(OnGraphCanvasManipulationStarted);
#else
            _graphCanvas.MouseEnter += new MouseEventHandler(OnGraphCanvasMouseEnter);
            _graphCanvas.MouseMove  += new System.Windows.Input.MouseEventHandler(OnGraphCanvasMouseMove);
            _graphCanvas.MouseLeave += new MouseEventHandler(OnGraphCanvasMouseLeave);
#endif
        }
Example #4
0
        private void AssignGridParts()
        {
            _valueAxis = (ValueAxis)TreeHelper.TemplateFindName("PART_ValueAxis", this);
            _valueGrid = (ValueGrid)TreeHelper.TemplateFindName("PART_ValueGrid", this);

            Binding formatBinding = new Binding("ValueFormatString");

            formatBinding.Source = this;
            _valueAxis.SetBinding(ValueAxis.ValueFormatStringProperty, formatBinding);

            _categoryAxis = (CategoryAxis)TreeHelper.TemplateFindName("PART_CategoryAxis", this);
#if WINDOWS_PHONE
            _categoryAxis.ManipulationStarted += new EventHandler <ManipulationStartedEventArgs>(OnGridManipulationStarted);
            _valueAxis.ManipulationStarted    += new EventHandler <ManipulationStartedEventArgs>(OnGridManipulationStarted);
#endif
        }
Example #5
0
        /// <summary>
        /// Applies control template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            _sliceCanvasDecorator              = (Border)TreeHelper.TemplateFindName("PART_SliceCanvasDecorator", this);
            _sliceCanvasDecorator.SizeChanged += new SizeChangedEventHandler(OnGraphCanvasDecoratorSizeChanged);
            _sliceCanvas = (Canvas)TreeHelper.TemplateFindName("PART_SliceCanvas", this);

            _balloon     = new Balloon(); //(Balloon)TreeHelper.TemplateFindName("PART_Balloon", this);
            this.ToolTip = _balloon;
            AddSlicesToCanvas();

            _legend = (Legend)TreeHelper.TemplateFindName("PART_Legend", this);

#if WINDOWS_PHONE
            _legend.ManipulationStarted += new EventHandler <ManipulationStartedEventArgs>(OnLegendManipulationStarted);
#endif

            UpdateLegend();
        }
Example #6
0
 /// <summary>
 /// Assigns control template parts.
 /// </summary>
 public override void OnApplyTemplate()
 {
     _gridCanvas = (Canvas)TreeHelper.TemplateFindName("PART_GridCanvas", this);
 }
Example #7
0
 /// <summary>
 /// Applies control template.
 /// </summary>
 public override void OnApplyTemplate()
 {
     _graphCanvas = (Canvas)TreeHelper.TemplateFindName("PART_GraphCanvas", this);
     _graphCanvas.Children.Add(_lineGraph);
 }
Example #8
0
        /// <summary>
        /// Applies control template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            _sliceVisual = (Path)TreeHelper.TemplateFindName("PART_SliceVisual", this);

            RenderSlice();
        }
Example #9
0
 /// <summary>
 /// Applies control template
 /// </summary>
 public override void OnApplyTemplate()
 {
     _valuesPanel = (Canvas)TreeHelper.TemplateFindName("PART_ValuesPanel", this);
     _tickPanel   = (Canvas)TreeHelper.TemplateFindName("PART_TickPanel", this);
 }