大家可能很纠结在异步query数据的时候想在wpf程序中显示一个loading的遮罩吧
今天就为大家介绍下遮罩的制作
源码下载 点击此处
先上张效果图看看 如果不如您的法眼 可以移步了 或者有更好的效果 可以留言给我
废话不多说 直接贴代码 一个usercontrol
<UserControl x:Class="LoadingMask_Demo.LoadingWait"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
IsVisibleChanged="HandleVisibleChanged">
<UserControl.Background>
<SolidColorBrush Color="Black" Opacity="0.2" />
</UserControl.Background>
<UserControl.Resources>
<SolidColorBrush Color="#FF007BE5" x:Key="CirclesColor" />
<!--<SolidColorBrush Color="Black" x:Key="BackgroundColor" Opacity=".20" />-->
</UserControl.Resources>
<Viewbox Width="100" Height="100"
HorizontalAlignment="Center"
VerticalAlignment="Center">
<Grid x:Name="LayoutRoot"
Background="Transparent"
ToolTip="Please wait...."
HorizontalAlignment="Center"
VerticalAlignment="Center">
<TextBlock Text="Loading..." HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14" Foreground="#FFE3953D" FontWeight="Bold" />
<Canvas RenderTransformOrigin="0.5,0.5"
HorizontalAlignment="Center"
VerticalAlignment="Center" Width="120"