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

相关推荐

  1. winform 异步初始化界面

    2024-04-20 12:24:02       18 阅读
  2. 【C#动态数据】“防界面卡死”

    2024-04-20 12:24:02       24 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-04-20 12:24:02       16 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-04-20 12:24:02       16 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-04-20 12:24:02       15 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-04-20 12:24:02       18 阅读

热门阅读

  1. WEB前端常规技术面试题之HTML+CSS基础

    2024-04-20 12:24:02       14 阅读
  2. centos安装mysql并设置远程访问

    2024-04-20 12:24:02       35 阅读
  3. Unity WebGL 2020 Release-Notes

    2024-04-20 12:24:02       21 阅读
  4. Mongodb

    Mongodb

    2024-04-20 12:24:02      18 阅读
  5. C++|list的模拟实现

    2024-04-20 12:24:02       14 阅读
  6. MySQL 8.0 vs MySQL 5.7: 详细比较

    2024-04-20 12:24:02       16 阅读
  7. C#中的Task:异步编程的瑞士军刀

    2024-04-20 12:24:02       17 阅读