Closed berruezo closed 10 months ago
I've tried to repro this but been unable to. I know we spoke in chat and you were unable to get a simple repro, but could you maybe describe how your columns are set up? Might give more of a clue.
Yes, the TemplateColumns
in the table are created using this method:
static IColumn<T> BuildTemplateColumn(
string columnName,
int columnWidth,
Func<string, T, PlasticTableCell> cellFunc,
IComparer<T> comparer)
{
return new TemplateColumn<T>(
columnName,
new FuncDataTemplate<T>((T node, INameScope ns) =>
{
return BuildCellControl(columnName, cellFunc, node);
}, true),
null,
GetGridLength(columnWidth),
new TemplateColumnOptions<T>
{
CompareAscending = Sort(comparer, false),
CompareDescending = Sort(comparer, true)
})
{
Tag = columnName,
};
For the first column, the grid length is new GridLength(1, GridUnitType.Star);
And for the other two it's new GridLength(100, GridUnitType.Pixel);
Also, the TreeDataGrid
is inside a non-resizable Window; it has a fixed width, and these two options:
CanResize = false;
SizeToContent = SizeToContent.Height;
I saw that when executing a LayoutPass
on the TreeDataGrid
the Bounds.Size
is 0,0
.
The EffectiveViewport.Size
is correct, but the Intersect
operation is causing the Viewport
to be of size 0,0
as well, and thus using a wrong availableWidth
when calculating the star width.
On the previous version, the Bounds.Size
was correct, and the Viewport
was not empty when exiting this method.
Is this of any help?
Ok, the missing part was that the TreeDataGrid
needs to have no items for this to repro. Fix incoming.
When setting a
GridLength
ofGridUnitType.Star
in aTemplateColumn
, the actual width is not calculated correctly, and the column gets the minimum width possible:Digging into the code I saw that this method is always receiving 0 as the
availableWidth
, whereas in the previous version it received the actual available width for the column