WPF Extended.Wpf.Toolkit 加载界面

devtools/2024/10/22 16:44:53/

1、NuGet 中安装 Extended.Wpf.Toolkit 。

2、在MainWindow.xaml中添加xmlns:tk="http://schemas.xceed.com/wpf/xaml/toolkit" 。

MainWindow.xaml 代码如下。

<Window x:Class="WPF_Extended_Wpf_Toolkit_Loading.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WPF_Extended_Wpf_Toolkit_Loading"
        xmlns:tk="http://schemas.xceed.com/wpf/xaml/toolkit"
        mc:Ignorable="d"        
        Title="MainWindow" Height="300" Width="300">
    <tk:BusyIndicator x:Name="BusyIndicator">
        <Grid>
            <Button x:Name="btnShowOrHideLoading" Width="100" Height="30" Content="显示加载框" Click="btnShowOrHideLoading_Click"/>
        </Grid>
    </tk:BusyIndicator>

</Window>
 

MainWindow.xaml.cs 代码如下。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WPF_Extended_Wpf_Toolkit_Loading
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        bool isBusy = false;
        public MainWindow()
        {
            InitializeComponent();
        }

        private void btnShowOrHideLoading_Click(object sender, RoutedEventArgs e)
        {
            this.BusyIndicator.IsBusy = !isBusy;
            if (this.BusyIndicator.IsBusy)
            {
                this.BusyIndicator.BusyContent = "正在加载";
            }            
        }
    }
}
 

3、这么简单应该不会还有人做不出来吧?做不出来的话那么下载一下我的资源吧。

https://download.csdn.net/download/xingchengaiwei/89146373


http://www.ppmy.cn/devtools/5960.html

相关文章

近端安全互联样例使用指导

样例介绍 本样例基于rk3568开发板&#xff0c;通过封装openharmony安全子系统deviceauth组件提供的能力&#xff0c;实现了一组可用于设备间快速建立可信认证和连接的接口&#xff0c;通过预先定义关系网&#xff0c;在设备初始化阶段完成端端设备间的认证&#xff0c;构建安全…

CSS3 伪元素与伪类选择器区别、详解与应用实例

伪元素与伪类两者都是通过在选择器后附加一个特定的关键字来定义&#xff0c;遵循相似的语法规则&#xff0c;并在 CSS 规则块中设置相应的样式。伪元素 能够通过 content 属性添加或替换内容。例如&#xff0c;:before 和 :after 可以插入文本、图像或其他生成的内容。伪类 仅…

Spark-机器学习(3)回归学习之线性回归

在之前的文章中&#xff0c;我们了解我们的机器学习&#xff0c;了解我们spark机器学习中的特征提取和我们的tf-idf&#xff0c;word2vec算法。想了解的朋友可以查看这篇文章。同时&#xff0c;希望我的文章能帮助到你&#xff0c;如果觉得我的文章写的不错&#xff0c;请留下你…

某零售企业招聘管理体系搭建咨询项目

科学岗位分析&#xff0c;改善招聘流程&#xff0c;提高招聘及时率随着公司不断发展壮大&#xff0c;企业规模逐渐增大&#xff0c;部门设置也日益增多&#xff0c;因此对人员的需求也日益提高。但是目前该企业在人员招聘方面逐渐暴露出一些诸如岗位分析不到位、缺乏整体面试计…

数学建模--非线性规划模型+MATLAB代码保姆式解析

目录 1.简单介绍 2.求解方法 3.适用赛题 4.典型例题及相关分析 &#xff08;1&#xff09;问题引入 &#xff08;2&#xff09;决策变量&约束条件 &#xff08;3&#xff09;确定目标函数 &#xff08;4&#xff09;建立数学模型 5.MATLAB代码祝逐字句讲解 1.简单…

线性代数基础2矩阵

矩阵是什么 矩阵就是二维数组&#xff0c;下面是一个 m 乘 n 的矩阵&#xff0c;它有 m 行&#xff0c;n 列&#xff0c;每行每列上面都有元素&#xff0c;每个元素都有行标i 和列标 j&#xff0c; a ij 。简称m n矩阵&#xff0c;记作&#xff1a; 注意a11的索引是 A[0,0]。…

js生成word

js生成word 下载依赖 npm install html-docx-js引入 import htmlDocx from html-docx-js/dist/html-docx;代码 //参数 html 文件名字 下载完执行回调函数 function html2word (html,fileName,callback){const converted htmlDocx.asBlob(html);const link document.cre…

袁庭新ES系列15节|Elasticsearch客户端基础操作

前言 上一章节我们介绍了搭建Elasticsearch集群相关的知识。那么又该如何来操作Elasticsearch集群呢&#xff1f;在ES官网中提供了各种语言的客户端&#xff0c;我们在项目开发过程中有多种Elasticsearch版本和连接客户端可以选择&#xff0c;那么他们有什么区别&#xff1f;这…