【问题标题】:Progress ring template for BusyIndicatorBusyIndicator 的进度环模板
【发布时间】:2014-07-14 21:57:51
【问题描述】:
【问题讨论】:
标签:
wpf
progress-bar
datatemplate
wpftoolkit
busyindicator
【解决方案1】:
BusyIndicator 被设计为内容控件。这意味着它会包装您放入的内容并为其添加广告。您可以为其创建一个 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>
这类似于 BusyIndicator 的构建方式,但允许您替换它使用的进度条。只需替换
顺便说一句,对于进度环,您可以使用图像视图并简单地围绕它自己无限旋转。