public void Add(string columnName, string headerText)
        {
            ColumnHeaderViewModel newItem = StaticContainer.Instance.Resolve <ColumnHeaderViewModel>();

            newItem.Name = columnName;
            newItem.Text = headerText;
            _viewModel.Columns.Items.Add(newItem);
            ResizeItems();
        }
        public void Insert(int index, string item)
        {
            ColumnHeaderViewModel newItem = StaticContainer.Instance.Resolve <ColumnHeaderViewModel>();

            newItem.Text = item.ToString();
            newItem.Name = item.ToString();
            _viewModel.Columns.Items.Insert(index, newItem);
            InsertNewItem(index, item);
        }
        private int IndexOfItem(ColumnHeaderViewModel item)
        {
            int innerIndex = -1;

            for (int i = 0; i < this._viewModel.Columns.Items.Count; i++)
            {
                if (item == _viewModel.Columns.Items[i])
                {
                    innerIndex = i;
                }
            }
            return(innerIndex);
        }
 public void Add(Object item)
 {
     if (item is ColumnHeaderViewModel)
     {
         var column = (ColumnHeaderViewModel)item;
         ColumnHeaderViewModel newItem = StaticContainer.Instance.Resolve <ColumnHeaderViewModel>();
         newItem.Name     = column.Name;
         newItem.Text     = column.Text;
         newItem.Width    = column.Width;
         newItem.Index    = _viewModel.Columns.Items.Count;
         newItem.ReadOnly = column.ReadOnly;
         _viewModel.Columns.Items.Add(newItem);
         ResizeItems();
     }
     else
     {
         ColumnHeaderViewModel newItem = StaticContainer.Instance.Resolve <ColumnHeaderViewModel>();
         newItem.Text = item.ToString();
         newItem.Name = item.ToString();
         _viewModel.Columns.Items.Add(newItem);
         ResizeItems();
     }
 }
 public void AddRange(object[] Columns)
 {
     foreach (var item in Columns)
     {
         if (item is string)
         {
             ColumnHeaderViewModel newItem = StaticContainer.Instance.Resolve <ColumnHeaderViewModel>();
             newItem.Name = item.ToString();
             newItem.Text = item.ToString();
             _viewModel.Columns.Items.Add(newItem);
         }
         else if (item is ColumnHeaderViewModel)
         {
             var column = (ColumnHeaderViewModel)item;
             ColumnHeaderViewModel newItem = StaticContainer.Instance.Resolve <ColumnHeaderViewModel>();
             newItem.Name     = column.Name;
             newItem.Text     = column.Text;
             newItem.Width    = column.Width;
             newItem.ReadOnly = column.ReadOnly;
             _viewModel.Columns.Items.Add(newItem);
         }
     }
     ResizeItems();
 }
 public bool Remove(ColumnHeaderViewModel item)
 {
     this.RemoveAt(IndexOfItem(item));
     return(true);
 }
 public bool Contains(ColumnHeaderViewModel item)
 {
     return(SelectedItems().Any(innerItem => innerItem == item));
 }
 public void Insert(int index, ColumnHeaderViewModel item)
 {
     _viewModel.Columns.Items.Insert(index, item);
     InsertNewItem(index);
 }