Skip to content

Commit 586edea

Browse files
authored
Fix WinUI splash screen icon not rendering (#4876)
1 parent 0ec372f commit 586edea

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

‎src/UniGetUI/MainWindow.xaml‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@
113113
Grid.ColumnSpan="3"
114114
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
115115
/>
116-
<!-- Splash: Height matches the 620:300 aspect ratio of SplashScreen.svg so the image fills the grid exactly. SvgImageSource is used so the host window's background shows through the transparent SVG. The tagline's 90px left margin shifts its centering from the image center (x=270) to the wordmark center (x≈315) within the 540-wide grid. -->
116+
<!-- Splash: 540x261 keeps the 620:300 aspect ratio of the artwork. Source is a transparent PNG set theme-aware in code-behind (SvgImageSource renders blank here). The tagline's 90px left margin shifts its centering to the wordmark center (x≈315) within the 540-wide grid. -->
117117
<Grid Grid.Row="1" Grid.Column="1" Width="540" Height="261">
118-
<Image Stretch="Uniform">
118+
<Image x:Name="SplashImage" Stretch="Uniform">
119119
<animations:Explicit.Animations>
120120
<animations:AnimationSet x:Name="InAnimation_Border">
121121
<animations:TranslationAnimation
@@ -132,9 +132,6 @@
132132
/>
133133
</animations:AnimationSet>
134134
</animations:Explicit.Animations>
135-
<Image.Source>
136-
<SvgImageSource UriSource="ms-appx:///Assets/SplashScreen.svg" RasterizePixelWidth="540" RasterizePixelHeight="261" />
137-
</Image.Source>
138135
</Image>
139136
<widgets:TranslatedTextBlock
140137
HorizontalAlignment="Center"

‎src/UniGetUI/MainWindow.xaml.cs‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public MainWindow()
6868

6969
LoadTrayMenu();
7070
ApplyTheme();
71+
ApplySplashImage();
7172
ApplyProxyVariableToProcess();
7273
_applySubtitleToWindow();
7374

@@ -706,6 +707,13 @@ public void ShowFromTray()
706707
Activate();
707708
}
708709

710+
private void ApplySplashImage()
711+
{
712+
bool dark = MainApp.Instance.ThemeListener.CurrentTheme == ApplicationTheme.Dark;
713+
string asset = dark ? "SplashScreen.theme-dark.png" : "SplashScreen.png";
714+
SplashImage.Source = new Microsoft.UI.Xaml.Media.Imaging.BitmapImage(new Uri($"ms-appx:///Assets/{asset}"));
715+
}
716+
709717
public void ApplyTheme()
710718
{
711719
string preferredTheme = Settings.GetValue(Settings.K.PreferredTheme);

0 commit comments

Comments
 (0)