private void AssignLegend() { _legend = (Legend)TreeHelper.TemplateFindName("PART_Legend", this); _legend.LegendItemsSource = this.Graphs.Cast <ILegendItem>(); // TODO: handle changes in Graphs _legend.ManipulationMode = ManipulationModes.All; _legend.ManipulationStarted += OnGridManipulationStarted; }
/// <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 }
private void AssignGraphCanvas() { _graphCanvasDecorator = (Border)TreeHelper.TemplateFindName("PART_GraphCanvasDecorator", this); _graphCanvasDecorator.SizeChanged += new SizeChangedEventHandler(OnGraphCanvasDecoratorSizeChanged); _graphCanvas = (Canvas)TreeHelper.TemplateFindName("PART_GraphCanvas", this); _graphCanvas.ManipulationMode = ManipulationModes.All; _graphCanvas.ManipulationStarted += OnGraphCanvasManipulationStarted; }
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 }
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 }
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 }
private void AssignGridParts() { _valueAxis = (ValueAxis)TreeHelper.TemplateFindName("PART_ValueAxis", this); _valueGrid = (ValueGrid)TreeHelper.TemplateFindName("PART_ValueGrid", this); Binding formatBinding = new Binding(); formatBinding.Path = new PropertyPath("ValueFormatString"); formatBinding.Source = this; _valueAxis.SetBinding(ValueAxis.ValueFormatStringProperty, formatBinding); _categoryAxis = (CategoryAxis)TreeHelper.TemplateFindName("PART_CategoryAxis", this); _categoryAxis.ManipulationMode = ManipulationModes.All; _categoryAxis.ManipulationStarted += OnGridManipulationStarted; _valueAxis.ManipulationMode = ManipulationModes.All; _valueAxis.ManipulationStarted += OnGridManipulationStarted; }
/// <summary> /// Applies control template. /// </summary> protected override void OnApplyTemplate() { this.ManipulationMode = ManipulationModes.All; _sliceCanvasDecorator = (Border)TreeHelper.TemplateFindName("PART_SliceCanvasDecorator", this); _sliceCanvasDecorator.SizeChanged += new SizeChangedEventHandler(OnGraphCanvasDecoratorSizeChanged); _sliceCanvas = (Canvas)TreeHelper.TemplateFindName("PART_SliceCanvas", this); _sliceCanvas.ManipulationMode = ManipulationModes.All; _balloon = (Balloon)TreeHelper.TemplateFindName("PART_Balloon", this); AddSlicesToCanvas(); _legend = (Legend)TreeHelper.TemplateFindName("PART_Legend", this); _legend.ManipulationMode = ManipulationModes.All; _legend.ManipulationStarted += OnLegendManipulationStarted; UpdateLegend(); }
/// <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 = (Balloon)TreeHelper.TemplateFindName("PART_Balloon", this); AddSlicesToCanvas(); _legend = (Legend)TreeHelper.TemplateFindName("PART_Legend", this); #if WINDOWS_PHONE _legend.ManipulationStarted += new EventHandler <ManipulationStartedEventArgs>(OnLegendManipulationStarted); #endif UpdateLegend(); }
/// <summary> /// Applies control template. /// </summary> public override void OnApplyTemplate() { _graphCanvas = (Canvas)TreeHelper.TemplateFindName("PART_GraphCanvas", this); _graphCanvas.Children.Add(_columnGraph); }
private void AssignBalloon() { _balloon = (Balloon)TreeHelper.TemplateFindName("PART_Balloon", this); }
/// <summary> /// Applies control template /// </summary> public override void OnApplyTemplate() { _valuesPanel = (Canvas)TreeHelper.TemplateFindName("PART_ValuesPanel", this); _tickPanel = (Canvas)TreeHelper.TemplateFindName("PART_TickPanel", this); }
/// <summary> /// Assigns control template parts. /// </summary> protected override void OnApplyTemplate() { _gridCanvas = (Canvas)TreeHelper.TemplateFindName("PART_GridCanvas", this); }
/// <summary> /// Applies control template. /// </summary> protected override void OnApplyTemplate() { _graphCanvas = (Canvas)TreeHelper.TemplateFindName("PART_GraphCanvas", this); _graphCanvas.Children.Add(_lineGraph); }
/// <summary> /// Applies control template. /// </summary> public override void OnApplyTemplate() { _sliceVisual = (Path)TreeHelper.TemplateFindName("PART_SliceVisual", this); RenderSlice(); }