Hi
This works:
public class answered : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { Double b = (Double)value; return b * 350; } // No need to implement converting back on a one-way binding public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); }
+
<TextBlock Name="bestTimerRect" HorizontalAlignment="Left" Background="Firebrick" Width="{Binding proportionComplete, Converter={StaticResource answered}}"></TextBlock>
But, essentially the same operation, fails "Specified cast is not valid" (I have simplified to one binding here)
public class multiAnswered : IMultiValueConverter { public object Convert(object[] values, Type targetType,object parameter, System.Globalization.CultureInfo culture) { Double b = (Double)values[0]; return b * 350; } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) { throw new NotSupportedException("Cannot convert back"); } }
+
<TextBlock Name="bestTimerRect" HorizontalAlignment="Left" Background="Firebrick"><TextBlock.Width><MultiBinding Converter="{StaticResource multiAnswered}"><Binding Path="proportionComplete"></Binding></MultiBinding></TextBlock.Width></TextBlock>
Any help appreciated
Z