Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Charts/Isolines/FastIsolineDisplay.xaml.cs @ 13777

Last change on this file since 13777 was 12503, checked in by aballeit, 10 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.7 KB
RevLine 
[12503]1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Windows;
6using System.Windows.Controls;
7using System.Windows.Data;
8using System.Windows.Documents;
9using System.Windows.Input;
10using System.Windows.Media;
11using System.Windows.Media.Imaging;
12using System.Windows.Navigation;
13using System.Windows.Shapes;
14using Microsoft.Research.DynamicDataDisplay.Charts.Shapes;
15
16namespace 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}
Note: See TracBrowser for help on using the repository browser.