private static void OnItemsReplaced(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TemplateChart owner = (TemplateChart)d;

            IEnumerable oldValue = (IEnumerable)e.OldValue;
            IEnumerable newValue = (IEnumerable)e.NewValue;

            owner.DetachOldItems(oldValue);
            owner.AttachNewItems(newValue);
            owner.UpdateItems();
        }
        private static void OnTemplateReplaced(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TemplateChart owner = (TemplateChart)d;

            owner.UpdateItems();
        }