From e115bd541349f14dc3b7b549c3fe801ba4e2a387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wies=C5=82aw=20S=CC=8Colte=CC=81s?= Date: Sun, 17 Mar 2024 16:47:59 +0100 Subject: [PATCH] Use soft DataContext synchronization --- src/Avalonia.Controls.ItemsRepeater/Controls/ViewManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Avalonia.Controls.ItemsRepeater/Controls/ViewManager.cs b/src/Avalonia.Controls.ItemsRepeater/Controls/ViewManager.cs index 674389d..579cf12 100644 --- a/src/Avalonia.Controls.ItemsRepeater/Controls/ViewManager.cs +++ b/src/Avalonia.Controls.ItemsRepeater/Controls/ViewManager.cs @@ -129,7 +129,7 @@ public void ClearElementToElementFactory(Control element) // During creation of this object, we were the one setting the DataContext, so clear it now. if (virtInfo.MustClearDataContext) { - element.DataContext = null; + element.SetCurrentValue(Control.DataContextProperty, null); } if (_owner.ItemTemplateShim != null) @@ -634,7 +634,7 @@ Control GetElement() if (data != element) { // Prepare the element - element.DataContext = data; + element.SetCurrentValue(Control.DataContextProperty, data); virtInfo.MustClearDataContext = true; }