Skip to content

Latest commit

 

History

History
162 lines (117 loc) · 9.06 KB

getting-started.md

File metadata and controls

162 lines (117 loc) · 9.06 KB
title page_title description slug tags published position
Getting Started
Getting Started
This tutorial will walk you through the creation of a sample application that shows a RadSplashScreen using RadSplashScreenManager.
radsplashscreen-getting-started
getting,started,splashscreen,busyindicator
true
1

Getting Started with {{ site.framework_name }} SplashScreen

This tutorial will walk you through the creation of a sample application that shows a splash screen using RadSplashScreenManager.

Adding Telerik Assemblies Using NuGet

To use RadSplashScreen when working with NuGet packages, install the Telerik.Windows.Controls.Navigation.for.Wpf.Xaml package. The [package name may vary]({%slug nuget-available-packages%}) slightly based on the Telerik dlls set - [Xaml or NoXaml]({%slug xaml-vs-noxaml%})

Read more about NuGet installation in the [Installing UI for WPF from NuGet Package]({%slug nuget-installation%}) article.

tip With the 2025 Q1 release, the Telerik UI for WPF has a new licensing mechanism. You can learn more about it [here]({%slug installing-license-key%}).

Adding Assembly References Manually

If you are not using NuGet packages, you can add a reference to the following assemblies:

  • Telerik.Licensing.Runtime
  • Telerik.Windows.Controls
  • Telerik.Windows.Controls.Navigation

You can find the required assemblies for each control from the suite in the [Controls Dependencies]({%slug installation-installing-controls-dependencies-wpf%}) help article.

Showing Splash Screen

To show a splash screen, use the RadSplashScreenManager class. This allows you to display the default RadSplashScreen control or a custom control.

Note that the splash screen window is running on a separate UI thread.

You can start the splash screen anytime you need to indicate that some work is performed. The following example demonstrates how to show it before the MainWindow is loaded. To do this, call the RadSplashScreenManager.Show method. This displays a window hosting a RadSplashScreen control.

[C#] Example 1: Starting the splash screen on application startup

{{region radsplashscreen-getting-started-0}} public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { var dataContext = (SplashScreenDataContext)RadSplashScreenManager.SplashScreenDataContext; dataContext.ImagePath = "/SplashScreenWPFApplication;component/Images/splashscreen-for-wpf-image.png"; dataContext.Content = "Loading Application"; dataContext.Footer = "This is the footer.";

		RadSplashScreenManager.Show();
					
		Thread.Sleep(7000);	

		RadSplashScreenManager.Close();

		base.OnStartup(e);
	}
}	

{{endregion}}

{{ site.framework_name }} RadSplashScreen Overview

The splash screen is setup via the RadSplashScreenManager.SplashScreenDataContext object which by default holds an object of type SplashScreenDataContext. Read more about the data context in the [Splash Screen Manager]({%slug radsplashscreen-features-splashscreenmanager%}) article.

This example is using Thread.Sleep to imitate a loading process, but you can replace this by any code that takes time and notifies you about its actions. Basically, call Show method when you need to display the screen and once your action is completed call the Close method.

Showing Progress Bar

To enable the progress bar in RadSplashScreen, set the IsIndeterminate property of SplashScreenDataContext to False. Then you can control the range and current value via the ProgressValue, MinValue and MaxValue properties of the data context. Read more about this in the [Progress Bar]({%slug radsplashscreen-features-progress-bar%}) article.

Showing Custom User Control in the Splash Screen

RadSplashScreenManager can be used to display any UI element. This means that you can create a custom UserControl and pass its type to the Show method. You can also replace the RadSplashScreenManager.SplashScreenDataContext with a custom object that can be used with the UserControl.

[XAML] Example 2: Creating a UserControl

{{region radsplashscreen-getting-started-1}} {{endregion}}

[C#] Example 3: Defining custom model

{{region radsplashscreen-getting-started-2}} public class MyUserControlViewModel { public string Text { get; set; } public double Width { get; set; } public double Height { get; set; } } {{endregion}}

[C#] Example 4: Showing a splash screen with custom control

{{region radsplashscreen-getting-started-3}} RadSplashScreenManager.SplashScreenDataContext = new MyUserControlViewModel() { Text = "Loading applicaiton...", Width = 150, Height = 150 }; RadSplashScreenManager.Show(); {{endregion}}

{{ site.framework_name }} RadSplashScreen Custom Control

Setting a Theme

The controls from our suite support different themes. You can see how to apply a theme different than the default one in the [Setting a Theme]({%slug styling-apperance-implicit-styles-overview%}) help article.

important Changing the theme using implicit styles will affect all controls that have styles defined in the merged resource dictionaries. This is applicable only for the controls in the scope in which the resources are merged.

To change the theme, you can follow the steps below:

  • Choose between the themes and add reference to the corresponding theme assembly (ex: Telerik.Windows.Themes.Windows8.dll). You can see the different themes applied in the Theming examples from our {% if site.site_name == 'WPF' %}WPF Controls Examples{% else %}Silverlight Controls Examples{% endif %} application.

  • Merge the ResourceDictionaries with the namespace required for the controls that you are using from the theme assembly. For the RadSplashScreen, you will need to merge the following resources:

    • Telerik.Windows.Controls
    • Telerik.Windows.Controls.Navigation

Example 3 demonstrates how to merge the ResourceDictionaries so that they are applied globally for the entire application.

[XAML] Example 3: Merge the ResourceDictionaries

{{region radsplashscreen-getting-started_7}} <Application.Resources> <ResourceDictionary.MergedDictionaries> </ResourceDictionary.MergedDictionaries> </Application.Resources> {{endregion}}

Alternatively, you can use the theme of the control via the {% if site.site_name == 'WPF' %}StyleManager{% else %}StyleManager{% endif %}.

Figure 1 shows a RadSplashScreen with the Windows8 theme applied.

Figure 1: RadSplashScreen with the Windows8 theme

RadSplashScreen with Windows8 theme

{% if site.site_name == 'WPF' %}

Telerik UI for WPF Learning Resources

See Also

  • [Splash Screen Manager]({%slug radsplashscreen-features-splashscreenmanager%})
  • [Animations]({%slug radsplashscreen-features-animations%})