简体   繁体   English

是否可以在扩展WPF工具包的Busyindicator中更改繁忙的动画?

[英]Is it possible to change the busy animation in the Busyindicator of Extended WPF Toolkit?

Is it possible to change the busy animation in the Busyindicator of Extended WPF Toolkit? 是否可以在扩展WPF工具包的Busyindicator中更改繁忙的动画? In particular, I would like to change it to a .gif animation. 特别是,我想将其更改为.gif动画。

Yes, of course. 当然是。 You can define your own custom content ( documentation ). 您可以定义自己的自定义内容( 文档 )。

Busy indicator custom content example: 繁忙指标自定义内容示例:

 <xctk:BusyIndicator IsBusy="True" DisplayAfter="0">
       <xctk:BusyIndicator.BusyContentTemplate>
            <DataTemplate>
                 <StackPanel Margin="4">
                          <TextBlock Text="Downloading Email" FontWeight="Bold" HorizontalAlignment="Center"/>
                           <StackPanel Margin="4">
                               <TextBlock Text="Downloading message 4/10..."/>
                               <ProgressBar Value="40" Height="15"/>
                           </StackPanel>
                           <Grid>
                               <Grid.ColumnDefinitions>
                                   <ColumnDefinition/>
                                   <ColumnDefinition/>
                               </Grid.ColumnDefinitions>
                               <Button Grid.Column="0" Content="Pause" HorizontalAlignment="Right" Margin="0 0 2 0"/>
                               <Button Grid.Column="1" Content="Cancel" HorizontalAlignment="Left" Margin="2 0 0 0"/>
                           </Grid>
                  </StackPanel>
            </DataTemplate>
       </xctk:BusyIndicator.BusyContentTemplate>
       <xctk:BusyIndicator.OverlayStyle>
                  <Style TargetType="Rectangle">
                        <Setter Property="Fill" Value="#ffffeeee"/>
                  </Style>
       </xctk:BusyIndicator.OverlayStyle>
       <xctk:BusyIndicator.ProgressBarStyle>
                   <Style TargetType="ProgressBar">
                            <Setter Property="Visibility" Value="Collapsed"/>
                   </Style>
       </xctk:BusyIndicator.ProgressBarStyle>
       <ContentControl Style="{StaticResource SampleContent}"/>
</xctk:BusyIndicator>

To display animated GIF images in WPF you can use WPF Animated GIF . 要在WPF中显示动画GIF图像,您可以使用WPF动画GIF

Busy indicator with animated GIF: 繁忙的指标与动画GIF:

<xctk:BusyIndicator IsBusy="True" DisplayAfter="0">
    <xctk:BusyIndicator.BusyContentTemplate>
        <DataTemplate>
            <StackPanel Margin="5">                   
                <Image gif:ImageBehavior.AnimatedSource="loading.gif" Width="100" Height="100" />
            </StackPanel>
        </DataTemplate>
    </xctk:BusyIndicator.BusyContentTemplate>
    <xctk:BusyIndicator.OverlayStyle>
        <Style TargetType="Rectangle">
            <Setter Property="Fill" Value="#ffffeeee"/>
        </Style>
    </xctk:BusyIndicator.OverlayStyle>
    <xctk:BusyIndicator.ProgressBarStyle>
        <Style TargetType="ProgressBar">
            <Setter Property="Visibility" Value="Collapsed"/>
        </Style>
    </xctk:BusyIndicator.ProgressBarStyle>
    <ContentControl />
</xctk:BusyIndicator>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM