Skip to content

Commit

Permalink
always unlink parent (#7087)
Browse files Browse the repository at this point in the history
  • Loading branch information
ojhad authored May 18, 2022
1 parent 8516763 commit 7fedf3d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions dev/NavigationView/NavigationViewItemsFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,12 @@ void NavigationViewItemsFactory::RecycleElementCore(winrt::ElementFactoryRecycle

// Do not recycle SettingsItem
bool isSettingsItem = m_settingsItem && m_settingsItem == args.Element();


UnlinkElementFromParent(args);
if (m_itemTemplateWrapper && !isSettingsItem)
{
m_itemTemplateWrapper.RecycleElement(args);
}
else
{
UnlinkElementFromParent(args);
}
}
}

Expand All @@ -153,6 +150,7 @@ void NavigationViewItemsFactory::UnlinkElementFromParent(winrt::ElementFactoryRe
if (children.IndexOf(args.Element(), childIndex))
{
children.RemoveAt(childIndex);
args.Parent(nullptr);
}
}
}

0 comments on commit 7fedf3d

Please sign in to comment.