论坛
潜水/灌水快乐,沉淀知识,认识更多同行。
ToB圈子
加入IT圈,遇到更多同好之人。
朋友圈
看朋友圈动态,了解ToB世界。
ToB门户
了解全球最新的ToB事件
博客
Blog
排行榜
Ranklist
文库
业界最专业的IT文库,上传资料也可以赚钱
下载
分享
Share
导读
Guide
相册
Album
记录
Doing
搜索
本版
文章
帖子
ToB圈子
用户
免费入驻
产品入驻
解决方案入驻
公司入驻
案例入驻
登录
·
注册
只需一步,快速开始
账号登录
立即注册
找回密码
用户名
Email
自动登录
找回密码
密码
登录
立即注册
首页
找靠谱产品
找解决方案
找靠谱公司
找案例
找对的人
专家智库
悬赏任务
圈子
SAAS
ToB企服应用市场:ToB评测及商务社交产业平台
»
论坛
›
软件与程序人生
›
后端开发
›
.Net
›
大概是迄今为止最好用的WPF加载动画功能(没有之一) ...
大概是迄今为止最好用的WPF加载动画功能(没有之一)
大号在练葵花宝典
金牌会员
|
2024-5-15 17:21:07
|
显示全部楼层
|
阅读模式
楼主
主题
900
|
帖子
900
|
积分
2700
前言
当我们在开发应用程序时,用户体验往往是至关重要的一环。在应用程序加载大量数据或执行复杂操纵时,为用户提供一个良好的加载体验变得至关重要。加载动画是其中一个有效的方式,它不但能够告知用户应用程序正在进行工作,还能够缓解用户在等待过程中的焦急感。
一.需求分析
开发一个加载动画比较常见的做法一样平常有以下两种。
一种是直接在控件的上层添加一层半透明遮罩,在遮罩上面显示加载动画,必要显示加载效果的时候将这个遮罩显示出来,加载完成以后隐藏这个遮罩,这种方式固然也能实现需求,但是缺点也很明显,每次要使用加载效果的时候都必要单独添加遮罩代码,单独写控制显示和隐藏的代码,一个项目页面那么多,每次都这样整,那不得把人整瓦解了。
还有一种实现方式是开发一个控件,在这个控件当中实现遮罩的效果,然后用这个控件把页面内容包起来,这样直接控制这个控件的属性就能实现遮罩效果,这也是很多第三方控件库的实现方式。这种方式在易用性上固然有所提升,但是还是有上面的题目,每个要用的地方都得Copy一次代码。
今天我们这里使用第三种方式,那就是使用装饰器来实现这个功能,它的长处就是对源代码侵入很小,不用每次使用都Copy大段代码,并且可扩展性非常强。
二.根本用法
以下为示例代码,当ViewModel中的IsLoading属性值为True时,就会触发Loading动画。
View代码:
<Window
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>x:Class="LoadingDemo.Views.MainWindow"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>xmlns:extensions="clr-namespace:LoadingDemo.Extensions"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>xmlns:prism="http://prismlibrary.com/"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>Title="Loading测试"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>Width="1366"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>Height="768"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>prism:ViewModelLocator.AutoWireViewModel="True"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>FontSize="22"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>WindowStartupLocation="CenterScreen">
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Grid extensions:FrameworkElementExtension.IsLoading="{Binding IsLoading}">
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources></Grid>
</Window>
复制代码
ViewModel代码:
namespace LoadingDemo.ViewModels
{
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>public class MainWindowViewModel : BindableBase
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>{
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>private bool _isLoading = false;
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>public bool IsLoading
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>{
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>get { return _isLoading; }
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>set { this.SetProperty(ref _isLoading, value); }
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>}
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>}
}
复制代码
运行效果:
三、
高
级用法
2.1 FrameworkElementExtension.IsLoading只能在Grid上使用吗?
答:No,几乎全部控件都可以使用,Window、Page、UserControl、Panel、Button、Rectangle、Path、TextBox等等,都没题目,只必要将IsLoading设置为True,就会出现Loading效果。
2.2 我觉得加载动画欠好看,有没有办法换成其它的?
答:当然可以,除了默认加载效果以外,还可以添加任意你喜欢的效果,不管它是文字、动画、视频、gif图片还是其它的东西,通通都可以,并且操纵非常简单,一共有两种方式。
方式一:同一添加的方式
只需在Resources中添加一个名为MaskContent的资源,在触发加载遮罩显示的时候就会自动读取该资源作为动画元素,如果放在App.Resources中,整个项目全部加载效果都使用该资源,如果放在Window.Resources中,Window中的全部加载效果都使用该资源,以此类推。以下都是正当的代码。
添加自定义动画效果(用户控件)
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>
复制代码
添加文字
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>
复制代码
添加进度条控件
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>
复制代码
方式二:单独添加的方式
<Window
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>x:Class="LoadingDemo.Views.MainWindow"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>xmlns:extensions="clr-namespace:LoadingDemo.Extensions"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>xmlns:prism="http://prismlibrary.com/"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>Title="Loading测试"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>Width="1366"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>Height="768"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>prism:ViewModelLocator.AutoWireViewModel="True"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>FontSize="22"
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>WindowStartupLocation="CenterScreen">
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Grid extensions:FrameworkElementExtension.IsLoading="{Binding IsLoading}">
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources><Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources>
<Window.Resources>
<Window.Resources>
<Window.Resources>
<ProgressBar x:Key="MaskContent" Width="150" Height="15" HorizontalAlignment="Center" VerticalAlignment="Center" IsIndeterminate="True" />
</Window.Resources><TextBlock x:Key="MaskContent" Text="加载中..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" FontWeight="Bold" Foreground="White" />
</Window.Resources><controls:CustomLoading x:Key="MaskContent" Width="35" Height="35" />
</Window.Resources></Grid>
</Window>
复制代码
四.综合案例
如需以上代码,请到群(661224882)共享文件中下载
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
本帖子中包含更多资源
您需要
登录
才可以下载或查看,没有账号?
立即注册
x
回复
使用道具
举报
0 个回复
正序浏览
返回列表
快速回复
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
or
立即注册
本版积分规则
发表回复
回帖并转播
发新帖
回复
大号在练葵花宝典
金牌会员
这个人很懒什么都没写!
楼主热帖
记一次MySql唯一索引在left join连表查 ...
鸿蒙系统架构分析
【大话云原生】微服务篇-五星级酒店的 ...
国产开源体系openEuler_24.03_LTS摆设 ...
2021年高教杯数学建模国赛C题的解题过 ...
STM32F1与STM32CubeIDE编程实例-磁簧开 ...
C# 使用dataGridView导入导出excel(NPO ...
渗透测试过程参考
MySQL实战45讲 3
GO实现Redis:GO实现内存数据库(3) ...
标签云
存储
挺好的
服务器
快速回复
返回顶部
返回列表