using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace _208621_RowIndicator_Background
{
	/// <summary>
	/// Interaction logic for Window1.xaml
	/// </summary>
	public partial class Window1 : Window
	{
		public Window1()
		{
			InitializeComponent();
			this.Loaded += this.Example_Loaded;
		}

		void Example_Loaded(object sender, RoutedEventArgs e)
		{
			RadGridView1.ItemsSource = new MyBusinessObjects().GetData(100);
		}

		public class MyBusinessObjects
		{
			string[] names = new string[] { "Côte de Blaye", "Boston Crab Meat", 
            "Singaporean Hokkien Fried Mee", "Gula Malacca", "Rogede sild", 
            "Spegesild", "Zaanse koeken", "Chocolade", "Maxilaku", "Valkoinen suklaa" };
			double[] prizes = new double[] { 23.2500, 9.0000, 45.6000, 32.0000, 
            14.0000, 19.0000, 263.5000, 18.4000, 3.0000, 14.0000 };
			DateTime[] dates = new DateTime[] { new DateTime(2007, 5, 10), new DateTime(2008, 9, 13), 
            new DateTime(2008, 2, 22), new DateTime(2009, 1, 2), new DateTime(2007, 4, 13), 
            new DateTime(2008, 5, 12), new DateTime(2008, 1, 19), new DateTime(2008, 8, 26), 
            new DateTime(2008, 7, 31), new DateTime(2007, 7, 16) };
			bool[] bools = new bool[] { true, false, true, false, true, false, true, false, true, false };

			public IEnumerable<MyBusinessObject> GetData(int maxItems)
			{
				Random rnd = new Random();

				return from i in Enumerable.Range(0, maxItems)
					   select new MyBusinessObject(i, names[rnd.Next(9)], prizes[rnd.Next(9)],
						   dates[rnd.Next(9)], bools[rnd.Next(9)]);
			}

			public class MyBusinessObject
			{
				private int id;
				private string name;
				private double unitPrice;
				private DateTime date;
				private bool discontinued;

				public MyBusinessObject(int ID, string Name, double UnitPrice, DateTime Date,
					bool Discontinued)
				{
					this.ID = ID;
					this.Name = Name;
					this.UnitPrice = UnitPrice;
					this.Date = Date;
					this.Discontinued = Discontinued;
				}

				public int ID
				{
					get
					{
						return id;
					}
					set
					{
						id = value;
					}
				}

				public string Name
				{
					get
					{
						return name;
					}
					set
					{
						name = value;
					}
				}

				public double UnitPrice
				{
					get
					{
						return unitPrice;
					}
					set
					{
						unitPrice = value;
					}
				}

				public DateTime Date
				{
					get
					{
						return date;
					}
					set
					{
						date = value;
					}
				}

				public bool Discontinued
				{
					get
					{
						return discontinued;
					}
					set
					{
						discontinued = value;
					}
				}
			}
		}
	}
}