protected override void DrawGeometry(bool withAnimation = true)
        {
            try
            {
                if (!shouldRender())
                {
                    return;
                }

                if (slice.Children.Count == 0)
                {
                    slice.Children.Add((UIElement)Activator.CreateInstance(DataPointType));
                }

                piece = (GAMultiPiece)slice.Children[0]; // the piece (GAColumn, GAScatter etc)

                generateBinding(BindingMode.TwoWay, "IsClickedByUser", piece, GAMultiPiece.IsClickedByUserProperty);
                generateBinding(BindingMode.TwoWay, "IsSelected", piece, GAMultiPiece.IsSelectedProperty);
                generateBinding(BindingMode.OneWay, "Percentage", piece, GAMultiPiece.PercentageProperty);
                generateBinding(BindingMode.OneWay, "IsNegativePiece", piece, GAMultiPiece.IsNegativePieceProperty);
                generateBinding(BindingMode.OneWay, "ClientWidth", piece, GAMultiPiece.ClientWidthProperty);
                generateBinding(BindingMode.OneWay, "ClientHeight", piece, GAMultiPiece.ClientHeightProperty);
                generateBinding(BindingMode.OneWay, "GAChartPieceStyle", piece, GAMultiPiece.GAChartPieceStyleProperty);
                generateBinding(BindingMode.OneWay, "GASelectedChartPieceStyle", piece, GAMultiPiece.GASelectedChartPieceStyleProperty);
                generateBinding(BindingMode.OneWay, "Background", piece, GAMultiPiece.BackgroundProperty);
                generateBinding(BindingMode.OneWay, "SelectedBrush", piece, GAMultiPiece.SelectedBrushProperty);
                generateBinding(BindingMode.OneWay, "ParentChart", piece, GAMultiPiece.ParentChartProperty);
                generateBinding(BindingMode.OneWay, "DataPointGroupIndex", piece, GAMultiPiece.DataPointGroupIndexProperty);
                generateBinding(BindingMode.OneWay, "DataPointIndex", piece, GAMultiPiece.DataPointIndexProperty);
            }
            catch (Exception ex)
            {
            }
        }
示例#2
0
        private void setup()
        {
            bottomText = this.GetTemplateChild("BottomNumber") as AutoSizeTextBlock;
            topText    = this.GetTemplateChild("TopNumber") as AutoSizeTextBlock;

            Grid         mainGrid = (Grid)this.Parent;
            GAMultiPiece piece    = (GAMultiPiece)mainGrid.TemplatedParent;

            isNegativePiece = piece.Name == "NegativeMultiPiece";
            AutoSizeTextBlock MainTextBlock = this.GetTemplateChild("MainTextBlock") as AutoSizeTextBlock;;

            // Bind mainTextBox IsHeightExceedsSpaceProperty to this TextExceedsHeight
            var mainTextBlockBinding = new Binding();

            mainTextBlockBinding.Source = this;
            mainTextBlockBinding.Mode   = BindingMode.OneWayToSource;
            mainTextBlockBinding.Path   = new PropertyPath("TextExceedsHeight");
            BindingOperations.SetBinding(MainTextBlock, AutoSizeTextBlock.IsHeightExceedsSpaceProperty, mainTextBlockBinding);
        }