我正在开发一个wpf应用程序,我想在其中显示一个进度动画,就像它在MozilaFirefox上的显示效果如下图所示。
我尝试使用状态栏控制WPF,但我希望它应该出现在窗口的顶部,并在处理完成后消失。
请引导一些例子。提示或建议将不胜感激。提前谢谢。
答案 0 :(得分:1)
你想要的是一个忙碌的指标。
Extended WPF Toolkit中提供了一个 - http://wpftoolkit.codeplex.com/wikipage?title=BusyIndicator。
Telerik suite of WPF controls中还有一个,此处为http://www.telerik.com/products/wpf/busyindicator.aspx。
两者都可以自定义以显示您自己的内容。
答案 1 :(得分:1)
这是XAML中的一个简单繁忙指标:
<Control Width="40">
<Control.Style>
<Style TargetType="Control">
<Setter Property="Foreground" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Control">
<Viewbox>
<Canvas RenderTransformOrigin="0.5,0.5" Width="40" Height="40">
<Canvas.Resources>
<Style TargetType="{x:Type Ellipse}">
<Setter Property="Stretch" Value="Fill"/>
<Setter Property="Fill" Value="Black"/>
</Style>
</Canvas.Resources>
<Ellipse Width="21.835" Height="21.862" Canvas.Left="20.1696" Canvas.Top="9.76358" Opacity="1.0"/>
<Ellipse Width="20.835" Height="20.862" Canvas.Left="2.86816" Canvas.Top="29.9581" Opacity="0.9"/>
<Ellipse Width="19.835" Height="19.862" Canvas.Left="0.00001" Canvas.Top="57.9341" Opacity="0.8"/>
<Ellipse Width="17.835" Height="17.862" Canvas.Left="12.1203" Canvas.Top="83.3163" Opacity="0.7"/>
<Ellipse Width="16.835" Height="16.862" Canvas.Left="36.5459" Canvas.Top="98.1380" Opacity="0.6"/>
<Ellipse Width="14.835" Height="14.862" Canvas.Left="64.6723" Canvas.Top="96.8411" Opacity="0.5"/>
<Ellipse Width="13.835" Height="13.862" Canvas.Left="87.6176" Canvas.Top="81.2783" Opacity="0.4"/>
<Ellipse Width="12.835" Height="12.862" Canvas.Left="98.165" Canvas.Top="54.4140" Opacity="0.3"/>
<Ellipse Width="11.835" Height="11.862" Canvas.Left="92.9838" Canvas.Top="26.9938" Opacity="0.2"/>
<Canvas.RenderTransform>
<RotateTransform x:Name="SpinnerRotate" Angle="0"/>
</Canvas.RenderTransform>
<Canvas.Triggers>
<EventTrigger RoutedEvent="ContentControl.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="SpinnerRotate" Storyboard.TargetProperty="Angle" From="0" To="360" Duration="0:0:01.3" RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Canvas.Triggers>
</Canvas>
</Viewbox>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Control.Style>
</Control>