当前位置: 首页 > news >正文

WPF Extended.Wpf.Toolkit 加载界面

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.lryc.cn/news/340234.html

相关文章:

  • 【切换网络连接后】VMware虚拟机网络配置【局域网通信】
  • 革新鞋服零售:数据驱动的智能商品管理 解锁库存优化与高效增长
  • word文件的创建时间和修改时间可以更改吗?答案是肯定的 文件属性修改的方法
  • redisson -- 延迟队列RDelayedQueue
  • Flex弹性盒子布局案例(认识弹性布局)
  • 【ros2】ros1和ros2可以同时在一台机器上运行吗
  • PMSM MATLAB
  • 笔记本电脑上的聊天机器人: 在英特尔 Meteor Lake 上运行 Phi-2
  • 【Web】陇原战“疫“2021网络安全大赛 题解
  • 010Node.js自定义模块通过exports的使用,两种暴露的方法及区别(二)
  • 【CVE-2010-2883】进行钓鱼攻击的研究
  • 【Python】如何在Ubuntu上设置Python脚本开机自启
  • 计算机视觉——OpenCV Python基于颜色识别的目标检测
  • 2024中国内燃机展-北京汽车发动机零部件展
  • 【iOS】——SDWebImage源码学习
  • 树和二叉树(一)
  • RAID 磁盘阵列及RAID配置实战
  • listpack
  • Web3与社会契约:去中心化治理的新模式
  • 实体类List重复校验
  • loadash常用的函数方法
  • 【零基础入门TypeScript】模块
  • Scala 之数组
  • 【Phytium】飞腾D2000 UEFI/EDK2 适配 RTC(IIC SD3077)
  • 如何利用纯前端技术,实现一个网页版视频编辑器?
  • stm32实现hid键盘
  • 【单例模式】饿汉式、懒汉式、静态内部类--简单例子
  • windows关闭Windows Search功能
  • 政安晨:【深度学习神经网络基础】(九)—— 在深度学习神经网络反向传播训练中理解梯度
  • 免费的 ChatGPT、GPTs、AI绘画(国内版)