Splash Around with the New Telerik UI for WPF Splash Screen

栏目: IT技术 · 发布时间: 5年前

内容简介:Customize the Splash Screen of your WPF application with our new addition to Telerik UI for WPF - the RadSplashScreen control!As part of ourBy default, the WPF framework allows you to display an image as the SplashScreen of the application, but the

Customize the Splash Screen of your WPF application with our new addition to Telerik UI for WPF - the RadSplashScreen control!

As part of our R1 2020 release for Telerik UI for WPF we introduced a brand new control - RadSplashScreen .

By default, the WPF framework allows you to display an image as the SplashScreen of the application, but the Telerik SplashScreen control changes the rules of the game by enabling you to show any WPF control, including all of the "Rad" controls, with your chosen Telerik theme.

Splash Around with the New Telerik UI for WPF Splash Screen

RadSplashScreenManager

You can setup your splash screen with the help of the RadSplashScreenManager . It allows you to show it, close it, change its animations as well as its startup position. All you need to do in order to display a splash screen is to call the Show method:

if (!RadSplashScreenManager.IsSplashScreenActive)

{

RadSplashScreenManager.Show();

}

This will display a RadSplashScreen control, which comes with all of the predefined UI for WPF themes. You can also display your custom control by utilizing the overload of the Show method, which accepts a type .

SplashScreenDataContext

Whether you are displaying a RadSplashScreen or a custom control, you can use the SplashScreenDataContext property to provide a DataContext. By default, an object of type SplashScreenDataContext is created, which allows you to control the appearance of the RadSplashScreen as shown in the following example:

public partial class App : Application

{

protected override void OnStartup(StartupEventArgs e)

{

base .OnStartup(e);

var dataContext = (SplashScreenDataContext)RadSplashScreenManager.SplashScreenDataContext;

dataContext.IsIndeterminate = false ;

dataContext.Content = "Loading..." ;

dataContext.MinValue = 0;

dataContext.MaxValue = 100;

dataContext.ProgressValue = 0;

dataContext.Footer = "Please, wait while the application is loading." ;

dataContext.MouseCursor = Cursors.Wait;

if (!RadSplashScreenManager.IsSplashScreenActive)

{

RadSplashScreenManager.Show();

}

for ( int i = 0; i < 100; i++)

{

dataContext.ProgressValue += 1;

dataContext.Content = $ "Loading... {i}%" ;

Thread.Sleep(50);

}

RadSplashScreenManager.Close();

}

}

Splash Around with the New Telerik UI for WPF Splash Screen

Animations

The RadSplashScreenManager has great opening and closing animations available out-of-the-box. That said, you can remove them entirely or customize them to your taste. Check out the following code snippet:

RadSplashScreenManager.ShowAnimation = new ScaleAnimation { Direction = AnimationDirection.In, Duration = TimeSpan.FromSeconds(1.5) };

RadSplashScreenManager.HideAnimation = new ScaleAnimation { Direction = AnimationDirection.Out, Duration = TimeSpan.FromSeconds(0.5) };

if (!RadSplashScreenManager.IsSplashScreenActive)

{

RadSplashScreenManager.Show();

}

Splash Around with the New Telerik UI for WPF Splash Screen

Read more about that in theAnimations article.

ProgressBar

The default look of the RadSplashScreen includes the familiarRadProgressBar. With its help and through the API exposed by the RadSplashScreenManager, you can easily indicate the loading progress of your application. Learn more about that in theProgressBar article.

Wrapping Up

Give the RadSplashScreen a try and let us know if you have any feedback. You can share any suggestions using ourfeedback portal. We would love to hear from you!

In case you missed it, make sure to check out the blog post covering the R1 2020 release: TaskBoard, SplashScreen, AgendaView and More in Telerik UI for WPF in R1 2020 .

Give Telerik UI for WPF a Trial Run!


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

程序员的数学思维修炼(趣味解读)

程序员的数学思维修炼(趣味解读)

周颖 / 清华大学出版社 / 2014-4-1 / 45.00元

本书是一本专门为程序员而写的数学书,介绍了程序设计中常用的数学知识。本书门槛不高,不需要读者精通很多高深的数学知识,只需要读者具备基本的四则运算、乘方等数学基础知识和日常生活中的基本逻辑判断能力即可。本书拒绝枯燥乏味的讲解,而是代之以轻松活泼的风格。书中列举了大量读者都很熟悉,而且非常有趣的数学实例,并结合程序设计的思维和算法加以剖析,可以训练读者的数学思维能力和程序设计能力,进而拓宽读者的视野,......一起来看看 《程序员的数学思维修炼(趣味解读)》 这本书的介绍吧!

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具