Skip to content

Commit a3488e1

Browse files
authored
Update MauiRecyclerView.cs (#30988)
1 parent 168e0af commit a3488e1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Controls/src/Core/Handlers/Items/Android/MauiRecyclerView.cs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,18 @@ public virtual void UpdateCanReorderItems()
286286

287287
public virtual void UpdateLayoutManager()
288288
{
289-
_layoutPropertyChangedProxy?.Unsubscribe();
289+
var itemsLayout = _getItemsLayout();
290+
291+
if (itemsLayout == ItemsLayout)
292+
{
293+
return;
294+
}
290295

291-
ItemsLayout = _getItemsLayout();
296+
_layoutPropertyChangedProxy?.Unsubscribe();
297+
ItemsLayout = itemsLayout;
292298

293299
// Keep track of the ItemsLayout's property changes
294-
if (ItemsLayout != null)
300+
if (ItemsLayout is not null)
295301
{
296302
_layoutPropertyChanged ??= LayoutPropertyChanged;
297303
_layoutPropertyChangedProxy = new WeakNotifyPropertyChangedProxy(ItemsLayout, _layoutPropertyChanged);

0 commit comments

Comments
 (0)