Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
workgroupengineering committed Apr 20, 2024
1 parent 1e223d2 commit 6502e1d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Avalonia.Controls/ItemsControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,13 @@ protected virtual void ContainerIndexChangedOverride(Control container, int oldI
/// <param name="container">The container element.</param>
protected internal virtual void ClearContainerForItemOverride(Control container)
{
// Ensure DataContex is Clear to avoid memory leak
// I use SetValue instead of ClearValue to avoid DataContext inheritance
container.SetValue(DataContextProperty, null);

//
KeyboardNavigation.SetTabOnceActiveElement(this, null);

if (container is HeaderedContentControl hcc)
{
hcc.ClearValue(HeaderedContentControl.ContentProperty);
Expand Down

0 comments on commit 6502e1d

Please sign in to comment.