示例#1
0
        private void Page_Initialized(object sender, EventArgs e)
        {
            #region comment

            /* var cars = new List<Car>();
             * for (int i = 0; i < 10; i++)
             * {
             *   byte red = (byte)(i % 3 == 0 ? 255 : (i * 50) % 255);
             *   byte green = 0;
             *   byte blue = (byte)(i % 3 == 0 ? 255 : (i * 90) % 255);
             *
             *   cars.Add(new Car()
             *   {
             *       Speed = i * 10,
             *       MainColor = Color.FromRgb(red, green, blue)
             *   });
             * }
             *
             * this.DataContext = cars;*/
            #endregion

            factory = new ProductsFactory();

            GrdProducts.ItemsSource = factory.GetAllProducts();
        }
示例#2
0
 private void Page_Initialized(object sender, EventArgs e)
 {
     //var cars = new List<Car>();
     //for (int i = 0; i < 10; i++)
     //{
     //    byte red = (byte)(i % 3 == 0 ? 255 : (i * 50) % 255);
     //    byte green = 0;
     //    byte blue = (byte)(i % 3 == 0 ? 255 : (i * 90) % 255);
     //    cars.Add(new Car()
     //    {
     //        Speed = i * 10,
     //        MainColor = Color.FromRgb(red,green,blue)
     //    });
     //}
     //this.DataContext = cars;
     factory = new ProductsFactory();
     GrdProducts.ItemsSource = factory.GetAllProducts();
 }