【问题标题】:Progress ring template for BusyIndicatorBusyIndi​​cator 的进度环模板
【发布时间】:2014-07-14 21:57:51
【问题描述】:

wpf 扩展工具包有一个 BusyIndi​​cator 控件,并且可以将模板应用于该控件中包含的进度条。 我希望进度条像 win 8 中的环形进度条(就像代码项目 http://www.codeproject.com/Articles/700185/Windows-Progress-Ring 中的这里一样),但我不能应用控件,只是一个 DataTemplate。 有什么想法吗?

【问题讨论】:

    标签: wpf progress-bar datatemplate wpftoolkit busyindicator


    【解决方案1】:

    BusyIndi​​cator 被设计为内容控件。这意味着它会包装您放入的内容并为其添加广告。您可以为其创建一个 ControlTemplate,但您必须将其设置为:

     <Style TargetType="{x:Type xctk:BusyIndicator}" x:Key="ProgressRing">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type xctk:BusyIndicator}">
                        <Grid>
                            <ContentControl Content="{TemplateBinding Content}"></ContentControl>
                            <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                                    x:Name="Overlay" Visibility="{TemplateBinding IsBusy, Converter={StaticResource BoolToVis}}">
                                <Border.Background>
                                    <SolidColorBrush Color="Black" Opacity="0.5"></SolidColorBrush>
                                </Border.Background>
                                <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">progress</TextBlock>
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    

    这类似于 BusyIndi​​cator 的构建方式,但允许您替换它使用的进度条。只需替换

    顺便说一句,对于进度环,您可以使用图像视图并简单地围绕它自己无限旋转。

    【讨论】:

      猜你喜欢
      • 2012-09-05
      • 1970-01-01
      • 1970-01-01
      • 2011-04-02
      • 2012-11-28
      • 2013-05-19
      • 2011-10-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多