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

前端 未结 1 695
耶瑟儿~
耶瑟儿~ 2021-01-20 00:13

Is it possible to change the busy animation in the Busyindicator of Extended WPF Toolkit? In particular, I would like to change it to a .gif animation.

相关标签:
1条回答
  • 2021-01-20 01:02

    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.

    Busy indicator with animated 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>
    
    0 讨论(0)
提交回复
热议问题