<Path x:Name="_value" Fill="{DynamicResource PositiveColorBrush}" Data="F1 M10,55 C10,57.75 7.75,60 5,60 2.25,60 0,57.75 0,55 L0,5 C0,2.25 2.25,0 5,0 7.75,0 10,2.25 10,5 L10,55 z">
<Path.Clip>
<!-- SECOND NUMBER CONTROLS THE HEIGHT : SCALE OF 0-60 REVERSED -->
<!--<RectangleGeometry Rect="0,22.82,10,60"/>-->
<RectangleGeometry
Rect="{Binding Score, Converter={StaticResource ChartBarScoreConverter}}" />
</Path.Clip>
</Path>
请注意此处注释的矩形几何体。当我取消对它的注释并注释掉绑定的矩形几何体时,这种方法非常有效。当然,它不会随着分数的变化而改变大小。
...
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
RectangleGeometry output = new RectangleGeometry();
double score = 60; //0
if (Common.IsNumeric(value))
{
score = System.Convert.ToDouble(value) * .60;//scale is 0-60
score = 60 - score;//reversed (=
}
output.Rect = new Rect(0, score, 10, 60);
return output;
}
...
有什么想法吗?
谢谢,
保罗