【发布时间】:2009-11-19 07:24:16
【问题描述】:
我正在围绕新的导航框架构建一个 Silverlight 应用程序。由于应用程序的性质,会有相当多的等待。
为此,我想为我的所有导航页面添加一个 Ajax 样式的加载动画。换句话说,当我去获取任何页面的数据时,我想显示加载动画。
我似乎找不到任何最新的示例?
【问题讨论】:
标签: silverlight-3.0 loading-animation
我正在围绕新的导航框架构建一个 Silverlight 应用程序。由于应用程序的性质,会有相当多的等待。
为此,我想为我的所有导航页面添加一个 Ajax 样式的加载动画。换句话说,当我去获取任何页面的数据时,我想显示加载动画。
我似乎找不到任何最新的示例?
【问题讨论】:
标签: silverlight-3.0 loading-animation
您可能想看看the Activity control。
【讨论】:
我认为实现这一点是使用 BusyIndicator。
你会参考这个:
xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
然后像这样使用 BusyIndicator(请注意绑定)。
<toolkit:BusyIndicator x:Name="busyIndicator" IsBusy="{Binding Path=IsBusy}">
<toolkit:BusyIndicator.BusyContent>
<StackPanel>
<TextBlock >Fetching data...</TextBlock>
<Rectangle RadiusX="10" RadiusY="10" Fill="#80000000" />
</StackPanel>
</toolkit:BusyIndicator.BusyContent>
....... XAML Code here
</toolkit:BusyIndicator>
然后在您的 ViewModel 上,每当您调用服务以获取数据或任何需要的过程(我使用的是 GalaSoft.MvvmLight)时,您都会提高 IsBusy 属性。
RaisePropertyChanged("IsBusy");
【讨论】: