Esempio n. 1
0
        // todo сделать привязку вьюпорта к контентбаундс.
        private static void OnContentBoundsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ViewportElement2D vElement = (ViewportElement2D)d;

            if (vElement.viewport != null)
            {
                // was uncommented
                ((Viewport2D)vElement.viewport).UpdateVisible();
            }
        }
 private void OnChartPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "Description")
     {
         ViewportElement2D chart = sender as ViewportElement2D;
         if (chart != null && cachedLegendItems.ContainsKey(chart))
         {
             // todo dirty, but quick to code.
             PopulateLegend();
         }
     }
 }
        private void graph_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Description")
            {
                ViewportElement2D graph         = (ViewportElement2D)sender;
                LegendItem        oldLegendItem = cachedLegendItems[graph];
                int index = stackPanel.Children.IndexOf(oldLegendItem);
                stackPanel.Children.RemoveAt(index);

                LegendItem newLegendItem = graph.Description.LegendItem;
                cachedLegendItems[graph] = newLegendItem;
                stackPanel.Children.Insert(index, newLegendItem);
            }
        }