protected virtual void OnSheetChanged(IRelationalSheet oldValue, IRelationalSheet newValue) { this.Columns.Clear(); if (newValue != null) { Columns.Add(new RawDataGridKeyColumn() { CanUserSort = true }); foreach (var col in newValue.Header.Columns) { Columns.Add(ColumnFactory.Create(col)); } } this.ItemsSource = new RawDataItemsSource(newValue); }
protected virtual void OnSheetChanged(IRelationalSheet oldValue, IRelationalSheet newValue) { this.Columns.Clear(); if (newValue != null) { var keyPath = newValue.Header.Variant == 1 ? "Key" : "FullKey"; //prevent multiple enumeration var columns = newValue.Header.Columns.ToList(); if (Settings.Default.SortByOffsets) { columns.Sort((x, y) => x.Offset.CompareTo(y.Offset)); } ColumnSetToRaw = new bool[columns.Count]; Columns.Add(new RawDataGridKeyColumn(keyPath) { CanUserSort = true }); foreach (var col in columns) { Columns.Add(ColumnFactory.Create(col)); } var source = new RawDataItemsSource(newValue); if (!string.IsNullOrWhiteSpace(Filter)) { source.Filter = Filter; } this.ItemsSource = source; } else { this.ItemsSource = null; } }