using System.Collections.ObjectModel;
using System.ComponentModel;

namespace CellTemplateProblem
{
    internal class MainWindowViewModel : INotifyPropertyChanged
    {
        private ObservableCollection<RowItem> _rowItems;
        public ObservableCollection<RowItem> RowItems
        {
            get { return _rowItems; }
            set
            {
                if (_rowItems == value) return;
                _rowItems = value;
                OnPropertyChanged("RowItems");
            }
        }

        public MainWindowViewModel()
        {
            RowItems = new ObservableCollection<RowItem>();
            for (int i = 0; i < 11; i++)
            {
                RowItems.Add(new RowItem { Id = i.ToString()});
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChanged(string property)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(property));
            }
        }
    }
}
