views:

27

answers:

1

Hi,

I have a collection of hex strings that represent colours and I am binding a combobox's ItemsSource to that collection.

The combobox items are templated to have a filled rectangle with the relevant colour. I therefore need to use a converter to convert the hex value to a string. Easy enough.

However, Blend is telling me that this syntax is incorrect in my XAML:

Fill="{Binding, Converter={StaticResource StringToBrush}}"

Apparently, I can't use a converter against plain old 'Binding'. Blend says that something like this is syntactically correct:

Fill="{Binding Value, Converter={StaticResource StringToBrush}}" 

...However that obviously doesn't work.

I'm not quite au fait with binding syntax yet, so obviously I'm getting it wrong.

Can anyone advise the correct syntax to achieve what I'm trying to do (convert my bound String using the coverter StringToBrush)?

Thanks in advance!

AT

A: 

Got it... within about 3 minutes of posting.

I simply didn't need the comma!

The correct syntax is: Fill="{Binding Converter={StaticResource StringToBrush}}"

Andy T