diff --git a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/PackageViewModel.cs b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/PackageViewModel.cs index 870cd06082..875c8d64eb 100644 --- a/tools/SetupFlow/DevHome.SetupFlow/ViewModels/PackageViewModel.cs +++ b/tools/SetupFlow/DevHome.SetupFlow/ViewModels/PackageViewModel.cs @@ -11,6 +11,7 @@ using DevHome.Services.WindowsPackageManager.Contracts; using DevHome.SetupFlow.Models; using DevHome.SetupFlow.Services; +using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Media.Imaging; using Windows.Storage.Streams; using Windows.System; @@ -96,7 +97,7 @@ public PackageViewModel( public IWinGetPackage Package => _package; - public BitmapImage Icon => _themeSelector.IsDarkTheme() ? _packageDarkThemeIcon.Value : _packageLightThemeIcon.Value; + public BitmapImage Icon => GetIconByTheme(); public string Name => _package.Name; @@ -202,14 +203,13 @@ private void ToggleSelection() _screenReaderService.Announce(announcementText); } - public BitmapImage GetLightThemeIcon() + private BitmapImage GetIconByTheme() { - return _package.LightThemeIcon == null ? DefaultLightPackageIconSource : CreateBitmapImage(_package.LightThemeIcon); - } - - public BitmapImage GetDarkThemeIcon() - { - return _package.DarkThemeIcon == null ? DefaultDarkPackageIconSource : CreateBitmapImage(_package.DarkThemeIcon); + return _themeSelector.GetActualTheme() switch + { + ElementTheme.Dark => _package.DarkThemeIcon == null ? DefaultDarkPackageIconSource : CreateBitmapImage(_package.DarkThemeIcon), + _ => _package.LightThemeIcon == null ? DefaultLightPackageIconSource : CreateBitmapImage(_package.LightThemeIcon), + }; } private BitmapImage CreateBitmapImage(IRandomAccessStream stream)