《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 WPF入门指南:如何自动或手动添加DXSplashScreen控件的更多相关文章

  1. DevExpress WPF入门指南:跟随 Items Source 向导完成数据绑定

    Items Source Wizard Items Source Configuration Wizard允许在设计时执行数据绑定.跟随这个向导可以自动生成XAML数据绑定代码. 下面就来展示下如何使 ...

  2. DevExpress WPF入门指南:DXWindow应用

    [DevExpress v17.2 版本更新公开课]点击免费报名 DevExpress WPF Window control有一点非常棒,就是可以和其他视觉主题保持统一性.DXWindow class ...

  3. DevExpress WPF入门指南:加载动画的应用

    LoadingDecorator是一个容器控件用于显示 long-loading 的内容.内容还没加载完成的时候会显示一个加载指示器,加载完成后指示器消失,如下图所示: 开启LoadingDecora ...

  4. DevExpress WPF v19.1新版亮点:PDF Viewer等控件新功能

    行业领先的.NET界面控件DevExpress 日前正式发布v19.1版本,本站将以连载的形式介绍各版本新增内容.在本系列文章中将为大家介绍DevExpress WPF v19.1中新增的一些控件及部 ...

  5. DevExpress WPF v19.1:Data Grid/Tree List等控件功能增强

    行业领先的.NET界面控件DevExpress 日前正式发布v19.1版本,本站将以连载的形式介绍各版本新增内容.在本系列文章中将为大家介绍DevExpress WPF v19.1中新增的一些控件及部 ...

  6. DevExpress WPF v19.1新版亮点:Data Editors等控件新功能

    行业领先的.NET界面控件DevExpress 日前正式发布v19.1版本,本站将以连载的形式介绍各版本新增内容.在本系列文章中将为大家介绍DevExpress WPFv19.1中新增的一些控件及部分 ...

  7. DevExpress WPF入门指南:绑定编辑器对话框

    绑定编辑器对话框 每个Smart Tag属性既可以设置也可以绑定.如下图所示,点击绑定按钮打开绑定对话框: 如果属性已经绑定,binging按钮会显示为黄色,绑定的文本会显示在相应的属性行. 绑定So ...

  8. DevExpress WPF入门指南:Smart Tag扩展功能

    Smart Tag提供了一些扩展功能用于简化指定某些属性的程序,比如下面这几项: Application Theme Data Context Image Gallery Convert to DXW ...

  9. 【翻译转载】【官方教程】Asp.Net MVC4入门指南(2):添加一个控制器

    2. 添加一个控制器 · 原文地址:http://www.asp.net/mvc/tutorials/mvc-4/getting-started-with-aspnet-mvc4/adding-a-c ...

随机推荐

  1. Ubuntu下Eclipse安装与编译ns-3遇见的各种问题

    感觉Eclipse比其它东西装起来麻烦多了. 问题拾遗 (1)安装 这一块倒是没有什么大的问题,Linux操作系统也不需要像在Windows操作系统下下一些必须的东西(比如CDT等等).安装好了JDK ...

  2. 05_Kafka Python_Consumer模拟

    Python客户端:  Kafka-python 安装:  pip install kafka-python Consumer端模拟代码 """ Kafka Consum ...

  3. shell 清空指定大小的日志文件

    #!/bin/bash # 当/var/log/syslog大于68B时 if ! [ -f /var/log/syslog ] then echo "file not exist!&quo ...

  4. python json 文件读写

    import json test_dict = {,,,} print(test_dict) print(type(test_dict))#字典 #dumps 将数据转换成字符串 json_str = ...

  5. DataTable转化成实体对象

    /// <summary> /// The data extension. /// </summary> public static class DataExtension { ...

  6. 【Mac】小技巧:实现ssh服务器别名免密登录

    前言 我们平常使用ssh user@host然后输入密码的方式来远程链接一个服务器,但是,如果要管理的服务器太多,记住这些服务器的IP和用户名.密码就是一个复杂的工作.当然,我们可以把这些信息用文档记 ...

  7. iconv编码转换

    环境:cocos2dx 3.10 1.vs环境下编译windows版本,需要增加头文件和链接库①cocos2d-x-3.10\external\win32-specific\icon\include② ...

  8. 算法笔记--lca倍增算法

    算法笔记 模板: vector<int>g[N]; vector<int>edge[N]; ][N]; int deep[N]; int h[N]; void dfs(int ...

  9. python导包显示No module named XXX问题

    最近用sublime text写python脚本,在导包是一直显示No module named XXX. 问题描述: 首先文件夹的目录结构如下: count.py文件,代码如下: #coding=u ...

  10. [Java学习] Java多态和动态绑定

    在Java中,父类的变量可以引用父类的实例,也可以引用子类的实例. 请读者先看一段代码: 1. public class Demo { 2. public static void main(Strin ...