DevExpress WPF入门指南:如何自动或手动添加DXSplashScreen控件
《DevExpress v17.2 版本更新公开课》点击报名
DevExpress WPF 的 DXSplashScreen 控件在应用加载的时候显示一个启动界面。添加DXSplashScreen后,会默认生成一个XAML文件,当然,你也可以根据自己的需求自定义XAML文件。
添加DXSplashScreen到项目中
1.右键单击 Solution Explorer 中的项目,并选择 Add DevExpress Item | New Item..

2.在弹出的 DevExpress Template Gallery 中单击 DXSplashScreen 项目。

添加DXSplashScreen后,会生成一个XAML文件。如果想自定义加载界面,修改XAML文件即可。
如何自动调用DXSplashScreen
DXSplashScreen可以在窗口加载时自动调用,然后在窗口初始化完毕后自动关闭,要实现这个功能,只需要在主窗口的XAML文件添加如下代码:
dxc:DXSplashScreen.SplashScreenType="{x:Type local:SplashScreenWindow1}"
dxc 和 local声明如下:
xmlns:local="clr-namespace:WpfApplication7"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/core"
但是这样做有个缺陷就是无法控制进度条的进程,要控制进程,就要用另一种方式:手动调用DXSplashScreen。
如何手动调用DXSplashScreen
你也可以手动控制合适显示和隐藏DXSplashScreen控件,这要通过DXSplashScreen类的一个静态方法来实现。
举个例子,下面的代码打开看一个应用程序的加载界面:
下面的代码关闭加载界面:
using DevExpress.Xpf.Core;
namespace WpfApplication7 {
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
}
void MainWindow_Loaded(object sender, RoutedEventArgs e) {
DXSplashScreen.Close();
this.Activate();
}
}
}
默认情况下,DXSplashScreen包含一个进度条,表示应用程序加载的进度,下面的代码就可以实现手动控制进度:
// Developer Express Code Central Example:
// How to manually invoke and close DXSplashScreen
//
// This example shows how to manually invoke and close DXSplashScreen. By default,
// DXSplashScreen contains a progress bar, indicating the progress of the
// application load. This example also shows how you can manually change the
// progress in code.
//
// You can find sample updates and versions for different programming languages here:
// http://www.devexpress.com/example=E3243 using DevExpress.Xpf.Core;
using System.Windows; namespace DXSplashScreenSample {
public partial class App : Application {
protected override void OnStartup(StartupEventArgs e) {
base.OnStartup(e);
DXSplashScreen.Show<SplashScreenView>();
}
}
}
===============================================================
DevExpress v17.2发布,更多精彩预告请持续关注DevExpress中文网!
扫描关注DevExpress中文网微信公众号,及时获取最新动态及最新资讯

DevExpress WPF入门指南:如何自动或手动添加DXSplashScreen控件的更多相关文章
- DevExpress WPF入门指南:跟随 Items Source 向导完成数据绑定
Items Source Wizard Items Source Configuration Wizard允许在设计时执行数据绑定.跟随这个向导可以自动生成XAML数据绑定代码. 下面就来展示下如何使 ...
- DevExpress WPF入门指南:DXWindow应用
[DevExpress v17.2 版本更新公开课]点击免费报名 DevExpress WPF Window control有一点非常棒,就是可以和其他视觉主题保持统一性.DXWindow class ...
- DevExpress WPF入门指南:加载动画的应用
LoadingDecorator是一个容器控件用于显示 long-loading 的内容.内容还没加载完成的时候会显示一个加载指示器,加载完成后指示器消失,如下图所示: 开启LoadingDecora ...
- DevExpress WPF v19.1新版亮点:PDF Viewer等控件新功能
行业领先的.NET界面控件DevExpress 日前正式发布v19.1版本,本站将以连载的形式介绍各版本新增内容.在本系列文章中将为大家介绍DevExpress WPF v19.1中新增的一些控件及部 ...
- DevExpress WPF v19.1:Data Grid/Tree List等控件功能增强
行业领先的.NET界面控件DevExpress 日前正式发布v19.1版本,本站将以连载的形式介绍各版本新增内容.在本系列文章中将为大家介绍DevExpress WPF v19.1中新增的一些控件及部 ...
- DevExpress WPF v19.1新版亮点:Data Editors等控件新功能
行业领先的.NET界面控件DevExpress 日前正式发布v19.1版本,本站将以连载的形式介绍各版本新增内容.在本系列文章中将为大家介绍DevExpress WPFv19.1中新增的一些控件及部分 ...
- DevExpress WPF入门指南:绑定编辑器对话框
绑定编辑器对话框 每个Smart Tag属性既可以设置也可以绑定.如下图所示,点击绑定按钮打开绑定对话框: 如果属性已经绑定,binging按钮会显示为黄色,绑定的文本会显示在相应的属性行. 绑定So ...
- DevExpress WPF入门指南:Smart Tag扩展功能
Smart Tag提供了一些扩展功能用于简化指定某些属性的程序,比如下面这几项: Application Theme Data Context Image Gallery Convert to DXW ...
- 【翻译转载】【官方教程】Asp.Net MVC4入门指南(2):添加一个控制器
2. 添加一个控制器 · 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-c ...
随机推荐
- ajax post 参数说明
- [codeWars] - 8kyu的简单复习
https://www.codewars.com/kata/5aa736a455f906981800360d public class Kata { public static boolean fea ...
- [echats] - EChats图表的使用
从上图可以看到,信息是能被抽象化为图形展示的,也就是基本的图表,曲线(想想股票那种曲线,普及一下那个叫K线图,想起当初去北京面试炒股公司的时候了...),柱状图等. 而apache开源的echats正 ...
- POJ 2506 Tiling(递推+大整数加法)
http://poj.org/problem?id=2506 题意: 思路:递推.a[i]=a[i-1]+2*a[i-2]. 计算的时候是大整数加法.错了好久,忘记考虑1了...晕倒. #includ ...
- MVC ---- Lambda表达式
Lambda表达式是比匿名函数还简洁的一种匿名方法语法 Lambda表达式缩写推演 new Func<string,int>(delegate(string str){return str ...
- sliva数据库简介--转载
sliva rRNA数据库(http://www.arb-silva.de/)用来检查和比对RNA序列,既可以针对16S/18S,SSU,也可以针对23S/28S, LSU,包括了Bacteria, ...
- plsql过期解决方法
1.首先,登陆PL/SQL Developer,PL/SQL Developer要到期了 2.输入指令“regedit”打开注册表,如图所示 3.然后,在注册表里按HKEY_CURRENT_USER\ ...
- 更新自带pip
想安装docker-compose发现居然找不到pip curl https://bootstrap.pypa.io/get-pip.py | python 直接sudo不行.还是提示权限不够. su ...
- C++学习笔记(二)——交换函数(swap)
这次我们要透过一个简单的函数swap深入理解函数传参的本质以及在C++中如何选择传参方式. 先来看第一段程序: void swap(int x, int y) { int temp = y; y = ...
- js 数组的删除
var test=[1,2,1,2,3,4,5,6,7]; 1.remove test.remove(1) 位置 test.remove(-2) test.remove(2,3) 2 dele ...