Skip to content

Commit

Permalink
Switch from using PrepareContainerForItemOverride to IsItemItsOwnCont…
Browse files Browse the repository at this point in the history
…ainerOverride.
  • Loading branch information
UXP Controls Automated Porting System committed Dec 17, 2018
1 parent 7526468 commit 56fb005
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions dev/NavigationView/NavigationViewList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ bool NavigationViewList::IsItemItsOwnContainerOverride(winrt::IInspectable const
bool isItemItsOwnContainerOverride = false;
if (args)
{
// This validation is only relevant outside of the Windows build where WUXC and MUXC have distinct types.
#if !BUILD_WINDOWS
// Certain items are disallowed in a NavigationView's items list. Check for them.
if (args.try_as<winrt::Windows::UI::Xaml::Controls::NavigationViewItemBase>())
{
throw winrt::hresult_invalid_argument(L"MenuItems contains a Windows.UI.Xaml.Controls.NavigationViewItem. This control requires that the NavigationViewItems be of type Microsoft.UI.Xaml.Controls.NavigationViewItem.");
}
#endif

auto nvib = args.try_as<winrt::NavigationViewItemBase>();
if (nvib && nvib != m_lastItemCalledInIsItemItsOwnContainerOverride.get())
{
Expand Down Expand Up @@ -57,15 +66,6 @@ void NavigationViewList::PrepareContainerForItemOverride(winrt::DependencyObject
winrt::get_self<NavigationViewItem>(itemContainer)->ClearIsContentChangeHandlingDelayedForTopNavFlag();
}

// The following validation is only relevant outside of the Windows build where WUXC and MUXC have distinct types.
#if !BUILD_WINDOWS
// Certain items are disallowed in a NavigationView's items list. Check for them.
if (element.try_as<winrt::Windows::UI::Xaml::Controls::NavigationViewItemBase>())
{
throw winrt::hresult_invalid_argument(L"MenuItems contains a Windows.UI.Xaml.Controls.NavigationViewItem. This control requires that the NavigationViewItems be of type Microsoft.UI.Xaml.Controls.NavigationViewItem.");
}
#endif

__super::PrepareContainerForItemOverride(element, item);
}

Expand Down

0 comments on commit 56fb005

Please sign in to comment.