Skip to content

Commit

Permalink
Check for Control.CornerRadius before loading rs5 generic.xaml (#297)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmahone authored Feb 12, 2019
1 parent 50aec20 commit 3e43328
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
9 changes: 9 additions & 0 deletions dev/dll/SharedHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ bool SharedHelpers::IsApplicationViewGetDisplayRegionsAvailable()
return s_isApplicationViewGetDisplayRegionsAvailable;
}

bool SharedHelpers::IsControlCornerRadiusAvailable()
{
static bool s_isControlCornerRadiusAvailable =
IsSystemDll() ||
Is19H1OrHigher() ||
(IsRS5OrHigher() && winrt::ApiInformation::IsPropertyPresent(L"Windows.UI.Xaml.Controls.Control", L"CornerRadius"));
return s_isControlCornerRadiusAvailable;
}

bool SharedHelpers::IsTranslationFacadeAvailable(const winrt::UIElement& element)
{
static bool s_areFacadesAvailable = (element.try_as<winrt::Windows::UI::Xaml::IUIElement9>() != nullptr);
Expand Down
6 changes: 3 additions & 3 deletions dev/dll/ThemeResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ThemeResources::ThemeResources()
// RS3 styles should be used on builds where ListViewItemPresenter's VSM integration works.
bool isRS3OrHigher = SharedHelpers::DoesListViewItemPresenterVSMWork();
bool isRS4OrHigher = SharedHelpers::IsRS4OrHigher();
bool isRS5OrHigher = SharedHelpers::IsRS5OrHigher();
bool isRS5OrHigher = SharedHelpers::IsRS5OrHigher() && SharedHelpers::IsControlCornerRadiusAvailable();
bool is19H1OrHigher = SharedHelpers::Is19H1OrHigher();

bool isInFrameworkPackage = SharedHelpers::IsInFrameworkPackage();
Expand Down Expand Up @@ -132,7 +132,7 @@ void SetDefaultStyleKeyWorker(winrt::IControlProtected const& controlProtected,
// RS3 styles should be used on builds where ListViewItemPresenter's VSM integration works.
bool isRS3OrHigher = SharedHelpers::DoesListViewItemPresenterVSMWork();
bool isRS4OrHigher = SharedHelpers::IsRS4OrHigher();
bool isRS5OrHigher = SharedHelpers::IsRS5OrHigher();
bool isRS5OrHigher = SharedHelpers::IsRS5OrHigher() && SharedHelpers::IsControlCornerRadiusAvailable();
bool is19H1OrHigher = SharedHelpers::Is19H1OrHigher();

bool isInFrameworkPackage = SharedHelpers::IsInFrameworkPackage();
Expand Down Expand Up @@ -196,4 +196,4 @@ void SetDefaultStyleKeyWorker(winrt::IControlProtected const& controlProtected,
control5.DefaultStyleResourceUri(uri);
}
#endif
}
}
2 changes: 2 additions & 0 deletions dev/inc/SharedHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ class SharedHelpers

static bool IsApplicationViewGetDisplayRegionsAvailable();

static bool IsControlCornerRadiusAvailable();

static bool IsTranslationFacadeAvailable(const winrt::UIElement& element);

static bool IsIconSourceElementAvailable();
Expand Down

0 comments on commit 3e43328

Please sign in to comment.