예제 #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
        }
예제 #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
        }
예제 #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
        }
예제 #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
        }
예제 #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();
        }
예제 #6
0
 /// <summary>
 /// Assigns control template parts.
 /// </summary>
 public override void OnApplyTemplate()
 {
     _gridCanvas = (Canvas)TreeHelper.TemplateFindName("PART_GridCanvas", this);
 }
예제 #7
0
 /// <summary>
 /// Applies control template.
 /// </summary>
 public override void OnApplyTemplate()
 {
     _graphCanvas = (Canvas)TreeHelper.TemplateFindName("PART_GraphCanvas", this);
     _graphCanvas.Children.Add(_lineGraph);
 }
예제 #8
0
파일: Slice.cs 프로젝트: radtek/BACAClient
        /// <summary>
        /// Applies control template.
        /// </summary>
        public override void OnApplyTemplate()
        {
            _sliceVisual = (Path)TreeHelper.TemplateFindName("PART_SliceVisual", this);

            RenderSlice();
        }
예제 #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);
 }