在WPF中实现向导进度控制,可以使用ProgressRing
控件。ProgressRing
是一个环形进度条,用于显示执行任务的进度。以下是实现向导进度控制的步骤:
ProgressRing
控件。<Window x:Class="WpfApp1.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:WpfApp1"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
WindowTransitionsEnabled="False"
mc:Ignorable="d"
Title="MainWindow"
Height="450"
Width="800"
WindowStartupLocation="CenterScreen"
Loaded="Window_Loaded"
Style="{StaticResource DefaultWindow}">
<Window.DataContext>
<local:MainWindowViewModel />
</Window.DataContext>
<Window.Resources>
<local:StringToEnumConverter x:Key="StringToEnumConverter"/>
</Window.Resources>
<mah:MetroWindow.RightWindowCommands>
<mah:WindowCommands>
<Button x:Name="cmdMinimize"
Style="{StaticResource WindowMinimizeButton}" />
<Button x:Name="cmdMaximize"
Style="{StaticResource WindowMaximizeButton}" />
<Button x:Name="cmdExit"
Style="{StaticResource WindowExitButton}" />
</mah:WindowCommands>
</mah:MetroWindow.RightWindowCommands>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Panel.ZIndex="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="*" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<StackPanel Grid.Column="0" Grid.Row="0" Orientation="Horizontal">
<telerik:RadButton x:Name="cmdAdd"
Margin="80,5"
Padding="20,0"
FontFamily="Arial"
FontSize="14"
ToolTipService.ShowOnDisabled="true">
<TextBlock Text="添加任务" />
</telerik:RadButton>
<telerik:RadButton x:Name="cmdDelete"
Margin="5"
Padding="20,0"
FontFamily="Arial"
FontSize="14"
ToolTipService.ShowOnDisabled="true">
<TextBlock Text="删除任务" />
</telerik:RadButton>
</StackPanel>
<telerik:RadBusyIndicator x:Name="radBusyIndicator"
Grid.Column="0"
Grid.Row="1"
Margin="80,5,80,175"
IsBusy="{Binding IsBusy}"
BusyContent="{Binding BusyContent}"
FontFamily="Arial"
FontSize="14
领取专属 10元无门槛券
手把手带您无忧上云