none
Cannot create default converter to perform 'two-way' conversions between types 'System.Windows.Media.Color' and 'System.Windows.Media.Brush'

    Question

  • I have a databinding expression set to grab the solidcolor brush from a settings file and apply it to the foreground on a style for a textblock.  It appears that the text is getting the color correctly but these mesages are in the output log.  What can I do to get rid of these or do I neeed to worry about them

            <Style x:Key="lbItemMessageStyle" TargetType="{x:Type Inline}" BasedOn="{StaticResource tbTextBlockBase}">
                <Setter Property="Foreground" Value="{Binding Source={x:Static self:Properties.Settings.Default}, Path=ChatMessageTextColor.Color, Mode=TwoWay}"/>
                <Setter Property="Background" Value="{x:Null}"/>
            </Style>


    Thanks in advance
    Friday, February 13, 2009 8:34 PM

Answers

  • As error message indicates, you need to write your custom IValueConverter implementation to make the Color to Brush or vice versa, because the default converters built into the BindingExpression doesn't provide this type of conversion support.

    Hope this clears things up a little bit.


    Another Paradigm Shift
    http://shevaspace.blogspot.com
    • Marked as answer by Marco Zhou Monday, February 23, 2009 6:16 AM
    Tuesday, February 17, 2009 5:33 AM