I am using the Radial Progress Bar from the UWP ToolKit. I want to use this progress in a game that I creating. I have an image that I want to fill the foreground of the progress bar with. No matter what I try I cannot get the image to fill in the progress bar, in the manner a progress bar fills in.
I am currently trying to scale the image in the foreground but that isn't quite the effect I am going for.
XAML:
<toolKit:RadialProgressBar Width="316" Height="316" Minimum="0" Maximum="100" Value="{Binding Value}" Thickness="36"
BorderBrush="Transparent" >
<toolKit:RadialProgressBar.Foreground>
<ImageBrush ImageSource="ms-appx:///Assets/progress2.png" >
<ImageBrush.Transform>
<ScaleTransform CenterX="0" CenterY="0" ScaleX="{Binding Scale}" ScaleY="{Binding Scale}" />
</ImageBrush.Transform>
</ImageBrush>
</toolKit:RadialProgressBar.Foreground>
</toolKit:RadialProgressBar>
C#:
private int _value;
public int Value
{
get => _value;
set
{
if (_value != value)
{
_value = value;
RaisePropertyChanged(nameof(Value));
Scale = 1.0-(100.0 - (316.0 * (Convert.ToDouble(value) / 100.0) / 316.0 * 100.0))/100.0;
}
}
}
private double _scale;
public double Scale
{
get => _scale;
set
{
if (_scale != value)
{
_scale = value;
RaisePropertyChanged(nameof(Scale));
}
}
}
Below is the effect that the above code creates:
Is there a way to fill a progress bar with an image?