Hi,
When I am using the following code to show a splash screen using the RadSplashScreenManager, with StartupLocation = null, only the top left corner of the window is centered on the screen. I have the same behavior without customizing the SplashScreenDataContext :
var splashScreenDataContext = (SplashScreenDataContext)RadSplashScreenManager.SplashScreenDataContext;
splashScreenDataContext.ImageHeight = 300.0;
splashScreenDataContext.ImageStretch = Stretch.Uniform;
splashScreenDataContext.ImagePath = "/MyAssembly;component/Resources/MyImage.png";
RadSplashScreenManager.Show();
In the sample, your are using hard coded sizes (260 and 160) to calculate the StartupLocation of the splash screen :
private void ShowSplashScreen()
{
this.timer.Start();
Mouse.OverrideCursor = Cursors.Wait;
this.splashScreenDataContext = RadSplashScreenManager.SplashScreenDataContext as SplashScreenDataContext;
this.splashScreenDataContext.ImagePath = "/SplashScreen;component/SplashScreen.png";
this.splashScreenDataContext.IsIndeterminate = false;
this.splashScreenDataContext.Content = "Loading... 0%";
this.parentWindow.CanMove = false;
this.parentWindow.IsEnabled = false;
if (this.parentWindow.WindowState != System.Windows.WindowState.Maximized)
{
var x = this.parentWindow.Left + this.parentWindow.ActualWidth / 2 - 260;
var y = this.parentWindow.Top + this.parentWindow.ActualHeight / 2 - 160;
RadSplashScreenManager.StartupPosition = new System.Windows.Point(x, y);
}
RadSplashScreenManager.Show();
}
Hard coding the sizes of the window is obviously not ideal. Instead, the splash window should act like any Window with the property SizeToContent="WidthAndHeight".
Can you help ?