
Hi
I’ve created a dynamically sized gauge UserControl and using the dynamically sized TextBlock within the gauge same as in the Dynamic Sizing example. The control works as intended but there is an annoying binding error I can’t get rid of.
Error
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='0' BindingExpression:Path=UnitBaseY; DataItem='CircularGauge' (Name='myGauge'); target element is 'TextBlock' (Name=''); target property is 'FontSize' (type 'Double')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='0' BindingExpression:Path=UnitBaseY; DataItem='CircularGauge' (Name='myGauge'); target element is 'TextBlock' (Name=''); target property is 'FontSize' (type 'Double')
System.Windows.Data Error: 5 : Value produced by BindingExpression is not valid for target property.; Value='0' BindingExpression:Path=UnitBaseY; DataItem='CircularGauge' (Name='myGauge'); target element is 'TextBlock' (Name=''); target property is 'FontSize' (type 'Double')
Code
<UserControl x:Class="FontTest.VU_ResizableCurrent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:gauge="http://schemas.actiprosoftware.com/winfx/xaml/gauge"
xmlns:shared="http://schemas.actiprosoftware.com/winfx/xaml/shared"
xmlns:Comps="clr-namespace:FontTest"
mc:Ignorable="d"
d:DesignHeight="180" d:DesignWidth="190" >
<UserControl.Resources>
<shared:MultiplicationConverter x:Key="MultiplicationConverter" />
</UserControl.Resources>
<Grid>
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Fill="White" />
<shared:ResizableContentControl>
<gauge:CircularGauge x:Name="myGauge" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="1" FrameType="None" >
<gauge:CircularGauge.Items>
<TextBlock gauge:CircularGaugeBase.Y="18%" gauge:CircularGaugeBase.X="0%" Text="A" Foreground="Black" FontSize="{Binding UnitBaseY, ElementName=myGauge, Converter={StaticResource MultiplicationConverter}, ConverterParameter=0.15}" FontWeight="Bold"/>
<TextBlock gauge:CircularGauge.Y="-10%" Text="Resizable" Foreground="Green" FontSize="{Binding UnitBaseY, ElementName=myGauge, Converter={StaticResource MultiplicationConverter}, ConverterParameter=0.15}" />
<TextBlock gauge:CircularGauge.Y="10%" Text="Gauge" Foreground="Blue" FontSize="{Binding UnitBaseY, ElementName=myGauge, Converter={StaticResource MultiplicationConverter}, ConverterParameter=0.15}" />
</gauge:CircularGauge.Items>
</gauge:CircularGauge>
</shared:ResizableContentControl>
</Grid>
</UserControl>
Is there something I’m missing or is it possible to mute the Error?
Many Thanks
Miles