[聚合文章] DevExpress WPF入门指南:加载动画的应用

.Net 2017-12-11 19 阅读

LoadingDecorator是一个容器控件用于显示 long-loading 的内容。内容还没加载完成的时候会显示一个加载指示器,加载完成后指示器消失,如下图所示:

开启LoadingDecorator

用dx:LoadingDecorator标签:

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Views:NavigationView/>
<dx:LoadingDecorator Grid.Column="1">
<Views:MainView/>
</dx:LoadingDecorator>
</Grid>

自定义 Loading Indicator

LoadingDecorator提供了一系列属性,用于自定义Loading Indicator外观。

定义indicator 布局:LoadingDecorator.SplashScreenTemplate 属性;

传递自定义数据:LoadingDecorator.SplashScreenDataContext 属性;

更改加载条位置:LoadingDecorator.SplashScreenLocation 属性;

将加载条在窗口居中或者容器居中:(SplashScreenLocation.CenterWindow) or (SplashScreenLocation.CenterContainer).

<Grid>
...
<dx:LoadingDecorator Grid.Column="1" SplashScreenDataContext="{Binding ... }"

SplashScreenLocation="CenterContainer">
<dx:LoadingDecorator.SplashScreenTemplate>
<DataTemplate>
<Grid>
...
</Grid>
</DataTemplate>
</dx:LoadingDecorator.SplashScreenTemplate>
<Views:MainView/>
</dx:LoadingDecorator>
</Grid>

LoadingDecorator.BorderEffect 和 LoadingDecorator.BorderEffectColor 属性可以设置高亮效果。BorderEffect 设置边框高亮,BorderEffectColor 设置边框高亮颜色。

<dx:LoadingDecorator ... BorderEffect="Default" BorderEffectColor="Blue">
...
</dx:LoadingDecorator>

如果不想要加载条,将 LoadingDecorator.UseFadeEffect 设置 False 即可。

注:本文内容来自互联网,旨在为开发者提供分享、交流的平台。如有涉及文章版权等事宜,请你联系站长进行处理。