今天发现dev控件自带了等待框,调用方便,而且不会阻塞主线程。
拉一个窗体,界面上放两个按钮,显示等待框,隐藏。
<Window x:Class="WaitDialogTest.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:WaitDialogTest" mc:Ignorable="d" Title="MainWindow" Height="450" Width="800"> <Grid> <Button Content="显示等待框" HorizontalAlignment="Left" Margin="258,122,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click"/> <Button Content="隐藏" HorizontalAlignment="Left" Margin="464,122,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1"/> </Grid> </Window>