Skip to content

Commit

Permalink
Merge pull request #12174 from Gundz/12106
Browse files Browse the repository at this point in the history
Fixed issue where RowDetailsTemplate was getting the wrong DataContext
  • Loading branch information
maxkatz6 authored Jul 28, 2023
2 parents e394ca5 + 3fc0d19 commit 9808a44
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/Avalonia.Controls.DataGrid/DataGridRows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2969,11 +2969,8 @@ private void UpdateRowDetailsHeightEstimate()
var detailsContent = RowDetailsTemplate.Build(dataItem);
if (detailsContent != null)
{
detailsContent.DataContext = dataItem;
_rowsPresenter.Children.Add(detailsContent);
if (dataItem != null)
{
detailsContent.DataContext = dataItem;
}
detailsContent.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
RowDetailsHeightEstimate = detailsContent.DesiredSize.Height;
_rowsPresenter.Children.Remove(detailsContent);
Expand Down

0 comments on commit 9808a44

Please sign in to comment.