protected void MeasureAndArrange()
        {
            XYChart xyChart = null;
            object  el      = FindName("xyChart");

            if (el is XYChart)
            {
                xyChart = el as XYChart;
                Size size = new Size(xyChart.Width, xyChart.Height);
                // Measure and arrange the surface
                // VERY IMPORTANT
                xyChart.Measure(size);
                xyChart.Arrange(new Rect(size));
            }
        }