views:

35

answers:

1

I've got a simple question, I've got a combobox whose itemsSource is bound to a relatively expensive service call.

If I have the combobox in question disabled will the binding still fire? If so what I can I do to ensure that the expensive call is only made when it really needs to be?

A: 

You probably want to at least consider modifying the template for the ComboBox so that it uses a VirtualizingStackPanel, at least, as long as your service call fetches items one at a time. See this for a pretty good discussion of the issues.

Edit

To answer your actual question: no, disabling the ComboBox doesn't stop it from populating its items. I determined this by implementing a collection class, binding a ComboBox's ItemsSource to an instance of it, and watching it service its method calls. Its items get retrieved if the ComboBox is enabled. They even get retrieved if its Visibility is Collapsed. I'm pretty surprised; that's not what I would have expected at all.

Robert Rossney
Thanks for your reply - I'll take a look at the article - looks good.Thanks again.
JTinley