我想用 ProgressBarIndicator
制作自定义 ProgressBar
像图像。现在我正在创建 ImageBrush
并将其设置为 ProgressBar
的 Foreground
属性:
<ImageBrush x:Key="brush" Stretch="Uniform" ImageSource="/Assets/image.png"/>
<ProgressBar Foreground="{StaticResource brush}"
Background="{StaticResource GrayAppBrush}"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Grid.RowSpan="2"
Value="{Binding Progress}"
VerticalContentAlignment="Stretch"
Maximum="1"
Height="200"/>
但它的工作方式真的很奇怪:
就像您可以看到它水平和垂直拉伸(stretch)图像一样。但我不想让它拉伸(stretch)。我希望图像填充所有 ProgressBar
并随着运行进度变得可见。
这是我想要实现的类似目标:
c# XAML ProgressBar set gradient filling properly
但它对我不起作用,我想要图像而不是渐变。
最佳答案
尝试更改 imageBrush 的拉伸(stretch)属性,例如:
<ImageBrush x:Key="brush" Stretch="UniformToFill" ImageSource="/Assets/image.png"/>
关于c# - 自定义 ProgressBarIndicator WinRT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30476582/