Skip to content

Commit

Permalink
Remove validation checks when in the Windows build.
Browse files Browse the repository at this point in the history
  • Loading branch information
UXP Controls Automated Porting System committed Dec 12, 2018
1 parent 5839351 commit f3cd0de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions dev/NavigationView/NavigationView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3092,14 +3092,15 @@ void NavigationView::UpdateListViewItemSource()
dataSource = MenuItems();
}

// The following validation is only relevant outside of the Windows build where WUXC and MUXC have distinct types.
#if !BUILD_WINDOWS
auto iterable = dataSource.try_as<winrt::IIterable<winrt::IInspectable>>();
if (iterable)
{
// Certain items are disallowed in a NavigationView's items list. Check for them.
auto checkItemIsValid = [](const winrt::IInspectable& item)
{
auto wuxItem = item.try_as<winrt::Windows::UI::Xaml::Controls::NavigationViewItem>();
if (wuxItem)
if (item.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.");
}
Expand Down Expand Up @@ -3152,6 +3153,7 @@ void NavigationView::UpdateListViewItemSource()
{
m_menuItemsVectorChangedRevoker.revoke();
}
#endif

if (!m_appliedTemplate)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,6 @@ public void VerifyCanNotAddWUXItems()
Verify.Throws<Exception>(() => { navView.MenuItems.Add(wuxItem); });
});
}
}
#endif
}
}

0 comments on commit f3cd0de

Please sign in to comment.