private void UpdateColumnDefinitions() { while (ColumnDefinitions.Count > Columns && ColumnDefinitions.Count > 0) { ColumnDefinitions.Remove(ColumnDefinitions[ColumnDefinitions.Count - 1]); } while (ColumnDefinitions.Count < Columns) { ColumnDefinitions.Add(new ColumnDefinition()); } if (DesignerProperties.GetIsInDesignMode(this) == true) { AddDesignTimeBorders(); } }
private void RemoveColumn(ILogFileColumn column) { if (!_columnPresenters.Remove(column)) { Log.WarnFormat("Unable to remove column '{0}' it's not presented", column); return; } if (!_columnDefinitionsByColumn.TryGetValue(column, out var columnDefinition)) { Log.ErrorFormat("Inconsistency detected: A column presenter exists, but not column definition for column '{0}'!", column); return; } var firstIndex = ColumnDefinitions.IndexOf(columnDefinition); _columnDefinitionsByColumn.Remove(column); _columnsByColumnDefinition.Remove(columnDefinition); ColumnDefinitions.Remove(columnDefinition); OffsetColumnsFrom(firstIndex, -1); }