RWS / Multiselect-ComboBox

The multi selection combo box is a WPF custom control with multiple item selection capabilities, along with customizable features to group, sort and filter items in the collection.
Apache License 2.0
182 stars 55 forks source link

UI freezes if multiselectcombobox is not visible when a piece of UI is loaded #35

Closed lucyainsworth closed 2 years ago

lucyainsworth commented 4 years ago

I am working with the Mahapps UI api to show a custom dialog that contains an SDL multiselectcombobox. If the combobox is visible on dialog arrange/layout then the dialog will load & present without any issues; however if the combobox's visibility is collapsed then it will lock up the UI indefinitely. For the time being, my solution is to simply only use this control in containers that will always be visible on presentation, but it would be great if the visibility issues could be addressed.

Cheers! -Lucy

lucyainsworth commented 4 years ago

Alright i have a fix prepared to address this issue. It was related to 3 infinite loops buried in the control code: ItemsCoerceValueCallback, ItemsPropertyChangedCallback, SuggestionProviderPropertyChangedCallback.

These 3 methods should not be recursively calling themselves on app loaded, because if the visibility of the control is collapsed(Template not applied) then it will be a guaranteed infinite loop. The fix is to remove these 3 dispatcher calls, and instead make 1 dispatcher call within OnApplyTemplate. After making this change there are also a couple null checks that need to be added, but they were really needed regardless.

Impertatore commented 4 years ago

Hi @lucyainsworth, you are right on the money; please check out the latest release 1.0.18 that resolves a threading issue. Can you confirm again with the latest release?