DevExpress WPF入門指南:載入動畫的應用

AABBbaby發表於2017-12-11

LoadingDecorator是一個容器控制元件用於顯示 long-loading 的內容。內容還沒載入完成的時候會顯示一個載入指示器,載入完成後指示器消失,如下圖所示:

LoadingDecorator wpf載入動畫

開啟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>

載入動畫 載入指示器 Loading

如果不想要載入條,將 LoadingDecorator.UseFadeEffect 設定 False 即可。

慧都控制元件網全面開啟史上規模最大、折扣最低、力度最瘋狂的迎新特惠活動——百廠約惠,時間僅限26天!在此之際,DevExpress率先宣佈正式加入百廠約惠活動!

相關文章