WPF Extended.Wpf.Toolkit 加载界面

server/2024/9/25 3:22:43/

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/server/11144.html

相关文章

数据结构|树形结构|并查集

数据结构|并查集 并查集 心有猛虎&#xff0c;细嗅蔷薇。你好朋友&#xff0c;这里是锅巴的C\C学习笔记&#xff0c;常言道&#xff0c;不积跬步无以至千里&#xff0c;希望有朝一日我们积累的滴水可以击穿顽石。 有趣的并查集剧情演绎&#xff1a;【算法与数据结构】—— 并…

在 Node.js 中配置代理 IP 采集文章

不说废话&#xff0c;直接上代码&#xff1a; const http require(http); const https require(https);// 之后可以使用 http 或 https 模块发起请求&#xff0c;它们将自动使用配置的代理 // 代理ip&#xff1a;https://www.kuaidaili.com/?refrg3jlsko0ymg const proxy …

Github Actions实现CI/CD(golang项目)

Github Actions构建CI/CD&#xff08;golang项目&#xff09; 1 基础概念 1.1 Actions GitHub Actions允许构建一个完整的 CI/CD Pipeline&#xff0c;与 GitHub 生态系统深度集成&#xff0c;而无需使用 Travis CI 或者 Circle CI 等第三方服务&#xff0c;对于开源项目都是…

【LeetCode热题100】【贪心算法】划分字母区间

题目链接&#xff1a;763. 划分字母区间 - 力扣&#xff08;LeetCode&#xff09; 要将一个字符串划分为多个子串&#xff0c;要求每个字母只能出现在一个子串里面 如果一个字母的当前位置是它在这个字符串里面最后一次出现的位置&#xff0c;那么这里就应该划分出来成为子串…

微信小程序实时日志使用,setFilterMsg用法

实时日志 背景 为帮助小程序开发者快捷地排查小程序漏洞、定位问题&#xff0c;我们推出了实时日志功能。开发者可通过提供的接口打印日志&#xff0c;日志汇聚并实时上报到小程序后台。开发者可从We分析“性能质量->实时日志->小程序日志”进入小程序端日志查询页面&am…

类和对象(2)——封装(封装的概念、包、staic)

前言 面向对象程序三大特性&#xff1a;封装、继承、多态。而类和对象阶段&#xff0c;主要研究的就是封装特性。何为封装呢&#xff1f;简单来说就是套壳屏蔽细节。 一、什么是封装 1.1 概念 将数据和操作数据的方法进行有机结合&#xff0c;隐藏对象的属性和实现细节&…

分享几个申请免费SSL证书的平台

随着数字网络蓬勃发展&#xff0c;人们在享受互联网时代带来的便利生活外&#xff0c;网络安全问题也是日益变得严重&#xff1b;越来越多企业或个人选择通过安装SSL证书来保护网站的数据安全和提高企业的品牌形象&#xff0c;好在很多证书服务机构都有提供免费SSL证书申请的服…

ONLYOFFICE协作空间:团队高效协作的终极武器!

文章目录 ONLYOFFICE协作空间初创版专业版&#xff08;云端&#xff09;企业版&#xff08;内部部署&#xff09; 亮点功能实时多人协作编辑高效的项目管理工具无缝集成第三方存储服务安全性和合规性支持Markdown文件群组功能和存储配额管理嵌入功能和数据导入自托管协作空间支…