Browse Source
Merge pull request #5161 from donandren/issues/3648
fix datagrid virtualization in some situations
stable/0.10.0
Dan Walmsley
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
21 additions and
0 deletions
-
src/Avalonia.Controls.DataGrid/Primitives/DataGridRowsPresenter.cs
|
|
|
@ -22,6 +22,22 @@ namespace Avalonia.Controls.Primitives |
|
|
|
} |
|
|
|
|
|
|
|
private double _measureHeightOffset = 0; |
|
|
|
private double _effectiveViewPortHeight = 0; |
|
|
|
|
|
|
|
public DataGridRowsPresenter() |
|
|
|
{ |
|
|
|
EffectiveViewportChanged += OnEffectiveViewportChanged; |
|
|
|
} |
|
|
|
|
|
|
|
private void OnEffectiveViewportChanged(object sender, Layout.EffectiveViewportChangedEventArgs e) |
|
|
|
{ |
|
|
|
if (_effectiveViewPortHeight != e.EffectiveViewport.Height) |
|
|
|
{ |
|
|
|
_effectiveViewPortHeight = e.EffectiveViewport.Height; |
|
|
|
InvalidateMeasure(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private double CalculateEstimatedAvailableHeight(Size availableSize) |
|
|
|
{ |
|
|
|
if(!Double.IsPositiveInfinity(availableSize.Height)) |
|
|
|
@ -108,6 +124,11 @@ namespace Avalonia.Controls.Primitives |
|
|
|
/// </returns>
|
|
|
|
protected override Size MeasureOverride(Size availableSize) |
|
|
|
{ |
|
|
|
if (double.IsInfinity(availableSize.Height)) |
|
|
|
{ |
|
|
|
availableSize = availableSize.WithHeight(_effectiveViewPortHeight); |
|
|
|
} |
|
|
|
|
|
|
|
if (availableSize.Height == 0 || OwningGrid == null) |
|
|
|
{ |
|
|
|
return base.MeasureOverride(availableSize); |
|
|
|
|