Skip to content
This repository was archived by the owner on Apr 9, 2025. It is now read-only.

Commit 42d68bd

Browse files
Merge pull request #46 from giard-alexandre/feat/backport-tdg-master
feat: ports tdg upstream changes
2 parents ec12090 + fc1c413 commit 42d68bd

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/DynamicTreeDataGrid/DynamicFlatTreeDataGridSource.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,11 @@ public bool SortBy(IColumn? column, ListSortDirection direction) {
163163

164164
public IRows Rows => _rows ??= CreateRows();
165165

166-
public IEnumerable<TModel> Items => _items;
166+
public IEnumerable<TModel> Items {
167+
get => _items;
168+
set => throw new NotImplementedException(
169+
"Set is currently not implemented. Change the passed in ChangeSet instead.");
170+
}
167171

168172
public ITreeDataGridSelection? Selection {
169173
get {

src/DynamicTreeDataGrid/Models/Columns/DynamicColumnListBase.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,14 @@ namespace DynamicTreeDataGrid.Models.Columns;
1717
/// </remarks>
1818
public class DynamicColumnListBase<TModel> : NotifyingListBase<IDynamicColumn<TModel>>, IDynamicColumnsBase {
1919
private readonly HashSet<string> _nameSet = [];
20+
private bool _initialized;
2021
private double _viewportWidth;
2122

2223
public event EventHandler? LayoutInvalidated;
2324

2425
public Size CellMeasured(int columnIndex, int rowIndex, Size size) {
2526
var column = (IUpdateColumnLayout)this[columnIndex];
27+
_initialized = true;
2628
return new Size(column.CellMeasured(size.Width, rowIndex), size.Height);
2729
}
2830

@@ -94,7 +96,8 @@ public void SetColumnWidth(int columnIndex, GridLength width) {
9496
public void ViewportChanged(Rect viewport) {
9597
if (_viewportWidth != viewport.Width) {
9698
_viewportWidth = viewport.Width;
97-
UpdateColumnSizes();
99+
if (_initialized)
100+
UpdateColumnSizes();
98101
}
99102
}
100103

0 commit comments

Comments
 (0)