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

相关推荐
凌霜残雪3 小时前
WPF 3D图形编程核心技术解析
3d·wpf
△曉風殘月〆3 小时前
WPF MVVM入门系列教程(五、命令和用户输入)
wpf·mvvm
△曉風殘月〆8 小时前
WPF MVVM入门系列教程(六、ViewModel案例演示)
wpf·mvvm
凌霜残雪8 小时前
深入解析WPF中的3D图形编程:材质与光照
3d·wpf·材质
△曉風殘月〆1 天前
WPF实时调试的一种实现方法
wpf
冰茶_2 天前
WPF之高级绑定技术
microsoft·微软·c#·wpf·mvvm·数据绑定
冰茶_2 天前
WPF之尺寸属性层次
microsoft·微软·c#·wpf·布局系统
Dr.多喝热水2 天前
WPF 触发器 Trigger
wpf·trigger
△曉風殘月〆3 天前
WPF MVVM进阶系列教程(一、对话框)
wpf·mvvm
babytiger3 天前
如何用命令行判断一个exe是不是c#wpf开发的
开发语言·c#·wpf