public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            _container     = GetTemplateChild("Container") as Canvas;
            _xLine         = GetTemplateChild("PART_XLine") as XLine;
            _yLine         = GetTemplateChild("PART_YLine") as YLine;
            _relativeXLine = GetTemplateChild("PART_RelativeXLine") as RelativeXLine;
            _relativeYLine = GetTemplateChild("PART_RelativeYLine") as RelativeYLine;
            _chartValue    = GetTemplateChild("PART_ChartValue") as ChartValue;

            _templateApplied = true;

            UpdateStates();

            UpdateChartLayout();

            UpdateRelativeLayout();
        }
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            if (Template == null)
            {
                return;
            }
            //            _container = Template.FindName("Container", this) as Canvas;
            _container     = GetTemplateChild("Container") as Canvas;
            _yLine         = GetTemplateChild("PART_YLine") as YLine;
            _xLine         = GetTemplateChild("PART_XLine") as XLine;
            _relativeXLine = GetTemplateChild("PART_RelativeXLine") as RelativeXLine;
            _relativeYLine = GetTemplateChild("PART_RelativeYLine") as RelativeYLine;
            _chartValue    = GetTemplateChild("PART_ChartValue") as ChartValue;

            _templateApplied = true;

            UpdateStates();

            UpdateChartLayout();

            UpdateRelativeLayout();
        }