using System;
using System.Linq;
using System.Collections.ObjectModel;
using Telerik.Windows.Controls;

namespace GridViewInsidePanelBar
{
    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class MainViewModel : ViewModelBase
    {
        public ObservableCollection<DataItem> Tabs { get; set; }

        private DataItem currentTab;
        /// <summary>
        ///     Gets or sets the name.
        /// </summary>
        public DataItem CurrentTab
        {
            get
            {
                return this.currentTab;
            }
            set
            {
                if (this.currentTab != value)
                {
                    this.currentTab = value;
                    OnPropertyChanged("CurrentTab");
                }
            }
        }


        public MainViewModel()
        {
            this.Tabs = new ObservableCollection<DataItem>();
            for (int i = 0; i < 2; i++)
            {
                DataItem item = new DataItem()
                {
                    Header = String.Format("Tab {0}", i),
                    FlagProperty = i % 1 == 0
                };
                for (int j = 0; j < 15; j++)
                {
                    item.ContentData.Add(new Column
                    {
                        Column1 = String.Format("Record {0}.{1}", i, j),
                        Column2 = String.Format("Record {0}.{1}", i, j),
                        Column3 = String.Format("Record {0}.{1}", i, j),
                        Column4 = String.Format("Record {0}.{1}", i, j),
                        Column5 = String.Format("Record {0}.{1}", i, j),
                        Column6 = String.Format("Record {0}.{1}", i, j),
                        Column7 = String.Format("Record {0}.{1}", i, j),
                        Column8 = String.Format("Record {0}.{1}", i, j)
                    });
                }
                this.Tabs.Add(item);
            }
            this.CurrentTab = this.Tabs[0];
        }
    }
}
