Can we customize the RequestedTheme Dark color in WinUI3

Smrithi Surendran 61 Reputation points
2023-03-06T06:04:39.53+00:00

While loading the splash screen, we are seeing some black color flickering.
We are assigned RequestedTheme property as Dark and in the splash we have mp4 video and some text.

Could you please help here to customize the color of Dark RequestedTheme property to make similar to mp4 video background color.

Windows development | Windows App SDK
Developer technologies | C#
{count} votes

2 answers

Sort by: Most helpful
  1. Junjie Zhu - MSFT 21,646 Reputation points
    2023-03-09T09:25:40.33+00:00

    Hi @Smrithi Surendran ,

    The problem is not the dark theme, but the MediaPlayerElement will have a black background when it starts with a source.

    You need to delete source in xaml and add video source after MediaPlayerElement is loaded, so as to avoid black flickering.

    <MediaPlayerElement x:Name="SplashPlayer" Loaded="SplashPlayer_Loaded" Visibility="Visible" Height="200" Width="300" AutoPlay="True"/>
    
        private void SplashPlayer_Loaded(object sender, RoutedEventArgs e)
        {
            Uri pathUri = new Uri("ms-appx:///Assets/XboxSplashScreen.mp4");
            SplashPlayer.Source = MediaSource.CreateFromUri(pathUri);
        }
    

    Thank you.


  2. Castorix31 90,686 Reputation points
    2023-03-23T11:08:02.5333333+00:00

    The black background (or white depending on the Theme) can be removed with a SwapChainPanel, like I did in the sample : https://github.com/castorix/WinUI3_SwapChainPanel_Layered

    or you can use a Win32 layered window for SplashScreen, like in https://github.com/castorix/WinUI3_SplashScreen

    (a IMFPMediaPlayer control (or WMP, DirectShow, ...) could be added to this window)


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.