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

相关推荐
c#上位机1 天前
wpf路由事件
wpf
nashane1 天前
HarmonyOS 鸿蒙 2026 全栈实战:从手势驱动到分布式数据落地的完整架构
wpf·harmony app
秋雨雁南飞1 天前
WPF 国际化(全球化)管理
wpf
nashane2 天前
HarmonyOS 6.0 分布式数据库进阶:设备协同与高效数据同步实战(API 11 Stage 模型)
wpf·harmonyos 5
极客智造3 天前
WPF InputBindings MVVM详解
wpf
nashane3 天前
HarmonyOS 6.0 分布式数据实战:KVStore跨设备同步与高性能查询指南(API 11 Stage模型)
wpf·harmonyos 5
SEO-狼术3 天前
Easily Reorder Rows in WPF Grids
wpf
烟话67 天前
MVVM核心机制:属性通知与命令绑定解析
wpf
不知名君7 天前
WPF 的原生窗体标题栏主题自适应系统深浅主题
wpf
碎碎念的安静8 天前
WPF 与 Qt 进程间通信(IPC)
开发语言·qt·wpf