Silverlight 2 Combo Box binding sublety!

It is vital to bind the ItemsSource before Binding to the SelectedItem!!! Wow, that’s a tough one

This works:

<ComboBox ItemsSource=”{Binding AllCurrencyStrings}” SelectedItem=”{Binding Path=Currency, Mode=TwoWay, Converter={StaticResource ConverterEnumToString}}”/>

this does NOT work:

<ComboBox SelectedItem=”{Binding Path=Currency, Mode=TwoWay, Converter={StaticResource ConverterEnumToString}}” ItemsSource=”{Binding AllCurrencyStrings}” />

I hope someone finds this helpful

-Brant

Advertisements

6 Responses to “Silverlight 2 Combo Box binding sublety!”

  1. Chavdar Kulin Says:

    This is very strange to me too.
    Especially if you try to load asynchronously ItemsSource.

  2. DjoDjo Says:

    Thank you so much for this information, I would have lost hours and hours before figuring that out !!

    I guest you’re not the only one to talk about this ‘bug’ but you’re the first one I’ve found, means the one to congratulate !!!

  3. Todd Smith Says:

    Fixing bugs these days seems like a matter of winning the google search lottery.

    thx for the fix

  4. V Says:

    I just had the same issue and spent 4hrs before I found the bug. Then I googled to see if anybody had it before. I wish I saw it earlier!

  5. John Mc Says:

    Brant,
    Thanks for this little but very important tidbit of information. Silverlight 3 still has this problem. This is actually a golden nugget of information.

    Thanks again!

  6. Igor Says:

    Thank you! Combobox is really buggy.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: