Panuon / Panuon.WPF.UI

Professional wpf ui library.
Apache License 2.0
1.08k stars 110 forks source link

RingProgressBar控件设置PercentStringFormat属性后无论Value的值是多少进度条都是满的 #255

Closed ch-kail closed 1 month ago

ch-kail commented 1 month ago

RingProgressBar属性和style设置: <pu:RingProgressBar Grid.Row="1" Margin="0,20,0,0" Style="{StaticResource RingStandardProgressBarStyle}" Value="15.3" PercentStringFormat="P2" GeneratingPercentText="RingProgressBar_GeneratingPercentText" />

<Style x:Key="RingStandardProgressBarStyle" TargetType="pu:RingProgressBar"> <Setter Property="Minimum" Value="0" /> <Setter Property="Maximum" Value="100" /> <Setter Property="Width" Value="170" /> <Setter Property="Height" Value="170" /> <Setter Property="FontSize" Value="20" /> <Setter Property="BorderThickness" Value="18" /> <Setter Property="BorderBrush" Value="#22FFFFFF" /> <Setter Property="BorderBrush" Value="#226CBCEA" /> <Setter Property="Foreground" Value="#6CBCEA" /> <Setter Property="IsPercentVisible" Value="True" /> <Setter Property="ShadowColor" Value="#6CBCEA" /> <Setter Property="pu:ShadowHelper.ShadowDepth" Value="5" /> <Setter Property="pu:ShadowHelper.BlurRadius" Value="15" />

ch-kail commented 1 month ago

visual studio预览效果是正确的: image

运行效果错误: image

Mochengvia commented 1 month ago

Maximum的默认值是10。不要漏掉

Maximum="100"

属性

ch-kail commented 1 month ago

问题已解决,此前测试时GeneratingPercentText事件绑定了下面这个方法设置了Value的值 private void RingProgressBar_GeneratingPercentText(object sender, GeneratingPercentTextRoutedEventArgs e) { RingProgressBar sender1 = (RingProgressBar)sender; sender1.Value = 150; }