private void ResetOldFiltered() { while (_columns.Count > 0) { _filteredColumns.Add(_columns[0]); _columns.RemoveAt(0); } _filteredColumns.Sort(SortByPosition); foreach (var column in _filteredColumns) { _columns.Add(column); } _filteredColumns.Clear(); }
private static void TrimColumns(GridViewColumnCollection gridViewColumnCollection, int length) { while (gridViewColumnCollection.Count > length) { gridViewColumnCollection.RemoveAt(length); } }
protected void ReloadFiles() { _colors.Clear(); ISet <string> colors = new HashSet <string>(); foreach (string color in _colorResourceFiles.SelectMany(crd => crd.Colors.Keys)) { colors.Add(color); } int index = 0; foreach (string color in colors.OrderBy(c => c)) { _colors.Add(new ColorRow(this, color, index++)); } GridViewColumnCollection gvcc = ((GridView)ColorsList.View).Columns; for (int i = gvcc.Count; i > _colorResourceFiles.Count + 1; i--) { gvcc.RemoveAt(i - 1); } for (int i = gvcc.Count; i < _colorResourceFiles.Count + 1; i++) { DataTemplate colorTemplate = ColorsList.FindResource("ColorTemplate" + (i - 1)) as DataTemplate; gvcc.Add(new GridViewColumn { Width = 150, Header = _colorResourceFiles[i - 1].ThemeName, CellTemplate = colorTemplate, }); } }
private void SetupColumns() { OutlinerDocument document = __Document; __OutlinerTreeColumns = (GridViewColumnCollection)this.FindResource("gvcc"); while (__OutlinerTreeColumns.Count > 0) __OutlinerTreeColumns.RemoveAt(__OutlinerTreeColumns.Count - 1); for (int i = 0; i < document.ColumnDefinitions.Count; i++) AddColumnBinding(document.ColumnDefinitions[i], i); if (document.ColumnDefinitions.OrderOnInit != null) { string[] ids = document.ColumnDefinitions.OrderOnInit.Split(new char[] { ';' }); for (int i = 0; i < ids.Length; i++) { int newViewId = int.Parse(ids[i]); int currentViewId = GetViewColumnId(i); __OutlinerTreeColumns.Move(currentViewId, newViewId); } document.ColumnDefinitions.OrderOnInit = null; } OutlinerTree.HeaderVisible = (document.ColumnDefinitions.Count > 1) ? Visibility.Visible : Visibility.Collapsed; AdjustColumnSizes(); }