Example #1
0
 /// <summary>
 /// Add column to "selected" list (and remove from "available" list)
 /// </summary>
 /// <param name="column"></param>
 private void AddColumn(GuiGridColumn column)
 {
     SelectedColumns.Add(column);
     AvailableColumns.Remove(column);
     SelectedSelectedColumn  = column;
     SelectedAvailableColumn = null;
 }
        public void Add()
        {
            var selected = AvailableColumns.Where(c => c.IsSelected).ToArray();

            foreach (var item in selected)
            {
                AvailableColumns.Remove(item);
                item.IsSelected = false;
                SelectedColumns.Add(item);
            }
        }
Example #3
0
        private void ShowColumns()
        {
            // ToArray used to detach the selection collection while we change the lists.
            foreach (var col in SelectedAvailableColumns.ToArray())
            {
                AvailableColumns.Remove(col);
                VisibleColumns.Add(col);
            }

            SelectedAvailableColumns.Clear();
        }
        public void Reset()
        {
            while (SelectedColumns.Count > 0)
            {
                AvailableColumns.Add(SelectedColumns[0]);
                SelectedColumns.RemoveAt(0);
            }

            foreach (var column in DefaultColumns)
            {
                AvailableColumns.Remove(column);
                SelectedColumns.Add(column);
            }
        }
        public void DragDrop(object sourceHost, FieldMapperGridColumn source, object targetHost, FieldMapperGridColumn target, out FieldMapperGridColumn showAvailable, out FieldMapperGridColumn showSelected)
        {
            showAvailable = null;
            showSelected  = null;
            if (sourceHost == AvailableColumns && targetHost == AvailableColumns)
            {
                return;
            }

            if (sourceHost == AvailableColumns && targetHost == SelectedColumns && source != target)
            {
                source.Visible = true;
                AvailableColumns.Remove(source);
                if (target == null)
                {
                    AvailableColumns.Add(source);
                }
                else
                {
                    AvailableColumns.Insert(AvailableColumns.IndexOf(target), source);
                }
            }
            else if (sourceHost == SelectedColumns && targetHost == AvailableColumns)
            {
                source.Visible = false;
                showAvailable  = source;
            }
            else if (source != target)
            {
                AvailableColumns.Remove(source);
                if (target == null)
                {
                    AvailableColumns.Add(source);
                }
                else
                {
                    AvailableColumns.Insert(AvailableColumns.IndexOf(target), source);
                }
            }
        }