DIYGrid - handle null columns
This commit is contained in:
1 parent
904cea0389
commit
bdb7dfb8c6
1 file changed
+4
-6
@@ -127,7 +127,8 @@ namespace mbts.ui.controls {
|
||||
}
|
||||
// Clear out the UI
|
||||
_superheader_container.Children.Clear();
|
||||
if (Columns.Count == 0 || SuperHeaders == null) return;
|
||||
if (Columns == null || Columns.Count == 0 || SuperHeaders == null)
|
||||
return;
|
||||
|
||||
// Skip the frozen columns
|
||||
int count = FrozenColumnCount;
|
||||
@@ -142,8 +143,7 @@ namespace mbts.ui.controls {
|
||||
Columns.Skip(count).Take(sheader.Width)) {
|
||||
Style = style
|
||||
};
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
header_element = new ContentControl() {
|
||||
Content = sheader.FullHeader,
|
||||
Style = style,
|
||||
@@ -164,7 +164,6 @@ namespace mbts.ui.controls {
|
||||
_superheader_container.Children.Add(header_element);
|
||||
}
|
||||
_superheader_column_index = SuperHeaders.SelectMany(sh => Enumerable.Repeat(sh, sh.Width)).ToArray();
|
||||
|
||||
}
|
||||
|
||||
private static void columns_changed(DependencyObject d, DependencyPropertyChangedEventArgs args) {
|
||||
@@ -387,8 +386,7 @@ namespace mbts.ui.controls {
|
||||
/// This effectively replaces the entire Measure/Arrange pass of the grid rows (and enables column virtualization)
|
||||
/// Mouse events will be hit tested against this as well
|
||||
internal IEnumerable<ColumnGeometry> GetColumnGeometry() {
|
||||
if (_header_scroll_viewer != null && ActualWidth > 0) {
|
||||
var columns = Columns;
|
||||
if (_header_scroll_viewer != null && ActualWidth > 0 && Columns is ICollection<ColumnBase> columns) {
|
||||
double frozen_offset = 0;
|
||||
foreach (var col in columns.Take(_frozen_column_count)) {
|
||||
yield return new ColumnGeometry() {
|
||||
|
||||
Reference in new issue
Block a user