Search code examples
c#wpfmvvm-light

Which is the event of the combobox when I click to show the items?


I would like that when I click the combobox to see all the items that I can select, before show the items, serach in the database the items that it has to show.

But I don't do that when I click the item that I want to choose, that it good be the event selectedItem.

But I am not sure which is the event when I click the combobox to see all the items.

I am using MVVM Light.

Thanks.


Solution

  • This is DropDownOpened: https://learn.microsoft.com/pl-pl/dotnet/api/system.windows.controls.combobox.dropdownopened?view=netframework-4.8

    But I think you should consider doing it in a different manner. When user clicks combobox to show its items, he expect that the items... will be shown :) But you are going to load them. I suppose you use some kind of filtering data, and when user clicks the combobox, then proper data gets loaded. I would consider loading them on changing the filter. I think that loading data on combobox click is too late.