[12503] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using System.Windows;
|
---|
| 6 | using System.Windows.Controls;
|
---|
| 7 | using System.Windows.Data;
|
---|
| 8 | using System.Windows.Documents;
|
---|
| 9 | using System.Windows.Input;
|
---|
| 10 | using System.Windows.Media;
|
---|
| 11 | using System.Windows.Media.Imaging;
|
---|
| 12 | using System.Windows.Navigation;
|
---|
| 13 | using System.Windows.Shapes;
|
---|
| 14 | using Microsoft.Research.DynamicDataDisplay.Charts.Shapes;
|
---|
| 15 |
|
---|
| 16 | namespace Microsoft.Research.DynamicDataDisplay.Charts.Isolines
|
---|
| 17 | {
|
---|
| 18 | public partial class FastIsolineDisplay : IsolineGraphBase
|
---|
| 19 | {
|
---|
| 20 | public FastIsolineDisplay()
|
---|
| 21 | {
|
---|
| 22 | InitializeComponent();
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | protected override Panel HostPanel
|
---|
| 26 | {
|
---|
| 27 | get
|
---|
| 28 | {
|
---|
| 29 | return Plotter2D.CentralGrid;
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | public override void OnApplyTemplate()
|
---|
| 34 | {
|
---|
| 35 | base.OnApplyTemplate();
|
---|
| 36 |
|
---|
| 37 | var isolineRenderer = (FastIsolineRenderer)Template.FindName("PART_IsolineRenderer", this);
|
---|
| 38 | //Binding contentBoundsBinding = new Binding { Path = new PropertyPath("(0)", Viewport2D.ContentBoundsProperty), Source = isolineRenderer };
|
---|
| 39 | //SetBinding(Viewport2D.ContentBoundsProperty, contentBoundsBinding);
|
---|
| 40 |
|
---|
| 41 | if (isolineRenderer != null)
|
---|
| 42 | {
|
---|
| 43 | isolineRenderer.AddHandler(Viewport2D.ContentBoundsChangedEvent, new RoutedEventHandler(OnRendererContentBoundsChanged));
|
---|
| 44 | UpdateContentBounds(isolineRenderer);
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 | private void OnRendererContentBoundsChanged(object sender, RoutedEventArgs e)
|
---|
| 49 | {
|
---|
| 50 | UpdateContentBounds((DependencyObject)sender);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | private void UpdateContentBounds(DependencyObject source)
|
---|
| 54 | {
|
---|
| 55 | var contentBounds = Viewport2D.GetContentBounds(source);
|
---|
| 56 | Viewport2D.SetContentBounds(this, contentBounds);
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 | }
|
---|