c# - 自定义 ProgressBarIndicator WinRT

标签 c# image progress-bar winrt-xaml

我想用 ProgressBarIndicator 制作自定义 ProgressBar 像图像。现在我正在创建 ImageBrush 并将其设置为 ProgressBarForeground 属性:

<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"/>

但它的工作方式真的很奇怪: enter image description here

就像您可以看到它水平和垂直拉伸(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/

相关文章:

AndroidResultContracts.TakePicture() 返回 bool 值而不是位图

xml 添加带有实体的照片

python - 如何使用 Python 图像库裁剪通过鼠标单击选择的区域?

html - 中心进度条说明

python - 如何在Python命令行URL下载器中添加进度条?

C# - 检查 Windows10 上是否安装了 UWP 应用程序

c# - 何时使用 Powershell 与 C# 进行开发?

c# - Javascript与C#交叉编译转换

javascript - 在加载整个页面之前显示一个加载栏

c# - 在 UI 上下文中开始的任务