using C1.WPF.Chart;
using System.Windows.Controls;
using System.Windows.Documents;

namespace DrillDown
{
    /// <summary>
    /// Interaction logic for SunburstDemo.xaml
    /// </summary>
    public partial class SunburstDemo : UserControl
    {
        private DrillDownViewModel _vm;

        public SunburstDemo()
        {
            InitializeComponent();
            _vm = new DrillDownViewModel();
            this.DataContext = _vm;

            this.Loaded += (o, e) =>
            {
                this.sunburst.Invalidate();
            };
        }

        private void HandleSunburstRendering(object sender, RenderEventArgs e)
        {
            var layer = AdornerLayer.GetAdornerLayer(sunburst);
            if (layer != null && layer.GetAdorners(sunburst) == null)
            {
                layer.Add(new SunburstAdorner(sunburst));
            }
        }
    }
}
