Palette Settings not Working When Using RadSplashScreen
Environment
Product Version | 2020.3.1020 |
Product | RadSplashScreen for WPF |
Description
The palette settings are not working if you apply them just before openning a RadSplashScreen in the App's OnStartup override. The following code snippet shows this setup.
protected override void OnStartup(StartupEventArgs e)
{
StyleManager.ApplicationTheme = new FluentTheme();
// The following palette setting won't be applied neither in the RadSplashScreen or the Telerik controls in the main window.
FluentPalette.Palette.AccentColor = Colors.Red;
RadSplashScreenManager.Show();
Thread.Sleep(5000);
// show window here
RadSplashScreenManager.Close();
}
Solution
To resolve this, create a UserControl that hosts RadSplashScreen instance and apply the platte settings in the constructor of the UserControl. Then use the generic Show method in order to display it.
<UserControl x:Class="WpfApp1.SplashScreenUserControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfApp1" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<telerik:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
</UserControl.Resources>
<telerik:RadSplashScreen Content="{Binding Content}"
ImagePath="{Binding ImagePath}"
ImageStretch="{Binding ImageStretch}"
ImageWidth="{Binding ImageWidth}"
ImageHeight="{Binding ImageHeight}"
Footer="{Binding Footer}"
Cursor="{Binding MouseCursor}"
HorizontalContentAlignment="{Binding HorizontalContentAlignment}"
HorizontalFooterAlignment="{Binding VerticalContentAlignment}"
ProgressValue="{Binding ProgressValue}"
MaxValue="{Binding MaxValue}"
MinValue="{Binding MinValue}"
IsIndeterminate="{Binding IsIndeterminate}"
ProgressBarVisibility="{Binding IsProgressBarVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</UserControl>
public partial class SplashScreenUserControl : UserControl
{
public SplashScreenUserControl()
{
FluentPalette.Palette.AccentColor = Colors.Red;
InitializeComponent();
}
}
protected override void OnStartup(StartupEventArgs e)
{
StyleManager.ApplicationTheme = new FluentTheme();
RadSplashScreenManager.Show<SplashScreenUserControl>();
Thread.Sleep(5000);
// show window here
RadSplashScreenManager.Close();
}