public Example()
        {
            this.InitializeComponent();

            this.DataContext = SalesStatistics.Load();
            this.categoriesList.SelectedIndex = 0;
        }
        public static SalesStatistics Load()
        {
            SalesStatistics statistics = new SalesStatistics();
            double          doubleValue;

            Action <ProductStatistic> rootElementAction = (el) =>
            {
                statistics.AddProduct(el);
            };
            Action <XElement, ProductStatistic> childElementAction = (el, product) =>
            {
                string value = el.Value;

                switch (el.Name.LocalName)
                {
                case "Category":
                    product.Category = value;
                    break;

                case "Product":
                    product.Product = value;
                    break;

                case "SubCategory":
                    product.SubCategory = value;
                    break;

                case "target2010":
                    if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out doubleValue))
                    {
                        doubleValue        = Math.Round(doubleValue);
                        product.Target2010 = doubleValue;
                    }
                    break;

                case "target2011":
                    if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out doubleValue))
                    {
                        doubleValue        = Math.Round(doubleValue);
                        product.Target2011 = doubleValue;
                    }
                    break;

                case "target2012":
                    if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out doubleValue))
                    {
                        doubleValue        = Math.Round(doubleValue);
                        product.Target2012 = doubleValue;
                    }
                    break;

                case "total2010":
                    if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out doubleValue))
                    {
                        doubleValue        = Math.Round(doubleValue);
                        product.Actual2010 = doubleValue;
                    }
                    break;

                case "total2011":
                    if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out doubleValue))
                    {
                        doubleValue        = Math.Round(doubleValue);
                        product.Actual2011 = doubleValue;
                    }
                    break;

                case "total2012":
                    if (double.TryParse(value, NumberStyles.Any, CultureInfo.InvariantCulture, out doubleValue))
                    {
                        doubleValue        = Math.Round(doubleValue);
                        product.Actual2012 = doubleValue;
                    }
                    break;
                }
            };

            XmlDataParser.Parse("Grid.FirstLook.Data.ProductSales.xml", rootElementAction, childElementAction);

            return(statistics);
        }