|
|
|
@ -917,23 +917,23 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
//TODO Cleanup
|
|
|
|
double? _previousDetailsHeight = null; |
|
|
|
|
|
|
|
|
|
|
|
//TODO Animation
|
|
|
|
private void DetailsContent_SizeChanged(Rect newValue) |
|
|
|
private void DetailsContent_HeightChanged(double newValue) |
|
|
|
{ |
|
|
|
if (_previousDetailsHeight.HasValue) |
|
|
|
{ |
|
|
|
var oldValue = _previousDetailsHeight.Value; |
|
|
|
_previousDetailsHeight = newValue.Height; |
|
|
|
if (newValue.Height != oldValue && newValue.Height != _detailsDesiredHeight) |
|
|
|
_previousDetailsHeight = newValue; |
|
|
|
if (newValue != oldValue && newValue != _detailsDesiredHeight) |
|
|
|
{ |
|
|
|
|
|
|
|
if (AreDetailsVisible && _appliedDetailsTemplate != null) |
|
|
|
{ |
|
|
|
// Update the new desired height for RowDetails
|
|
|
|
_detailsDesiredHeight = newValue.Height; |
|
|
|
_detailsDesiredHeight = newValue; |
|
|
|
|
|
|
|
_detailsElement.ContentHeight = newValue.Height; |
|
|
|
_detailsElement.ContentHeight = newValue; |
|
|
|
|
|
|
|
// Calling this when details are not visible invalidates during layout when we have no work
|
|
|
|
// to do. In certain scenarios, this could cause a layout cycle
|
|
|
|
@ -943,19 +943,29 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_previousDetailsHeight = newValue.Height; |
|
|
|
_previousDetailsHeight = newValue; |
|
|
|
} |
|
|
|
} |
|
|
|
private void DetailsContent_BoundsChanged(Rect newValue) |
|
|
|
|
|
|
|
private void DetailsContent_SizeChanged(Rect newValue) |
|
|
|
{ |
|
|
|
if(_detailsContent != null) |
|
|
|
DetailsContent_SizeChanged(newValue.Inflate(_detailsContent.Margin)); |
|
|
|
DetailsContent_HeightChanged(newValue.Height); |
|
|
|
} |
|
|
|
private void DetailsContent_MarginChanged(Thickness newValue) |
|
|
|
{ |
|
|
|
if (_detailsContent != null) |
|
|
|
DetailsContent_SizeChanged(_detailsContent.Bounds.Inflate(newValue)); |
|
|
|
} |
|
|
|
private void DetailsContent_LayoutUpdated(object sender, EventArgs e) |
|
|
|
{ |
|
|
|
if (_detailsContent != null) |
|
|
|
{ |
|
|
|
var margin = _detailsContent.Margin; |
|
|
|
var height = _detailsContent.DesiredSize.Height + margin.Top + margin.Bottom; |
|
|
|
|
|
|
|
DetailsContent_HeightChanged(height); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//TODO Animation
|
|
|
|
// Sets AreDetailsVisible on the row and animates if necessary
|
|
|
|
@ -1035,12 +1045,26 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
if (_detailsContent != null) |
|
|
|
{ |
|
|
|
_detailsContentSizeSubscription = |
|
|
|
System.Reactive.Disposables.StableCompositeDisposable.Create( |
|
|
|
_detailsContent.GetObservable(BoundsProperty) |
|
|
|
.Subscribe(DetailsContent_BoundsChanged), |
|
|
|
if (_detailsContent is Layout.Layoutable layoutableContent) |
|
|
|
{ |
|
|
|
layoutableContent.LayoutUpdated += DetailsContent_LayoutUpdated; |
|
|
|
|
|
|
|
_detailsContentSizeSubscription = |
|
|
|
System.Reactive.Disposables.StableCompositeDisposable.Create( |
|
|
|
System.Reactive.Disposables.Disposable.Create(() => layoutableContent.LayoutUpdated -= DetailsContent_LayoutUpdated), |
|
|
|
_detailsContent.GetObservable(MarginProperty) |
|
|
|
.Subscribe(DetailsContent_MarginChanged)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
_detailsContentSizeSubscription = |
|
|
|
_detailsContent.GetObservable(MarginProperty) |
|
|
|
.Subscribe(DetailsContent_MarginChanged)); |
|
|
|
.Subscribe(DetailsContent_MarginChanged); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
_detailsElement.Children.Add(_detailsContent); |
|
|
|
} |
|
|
|
} |
|
|
|
|