Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion DropDownControls/GroupedComboBox/GroupedComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,16 @@ private enum RedrawWindowFlags : uint {
return (_bindingSource != null) ? _bindingSource.DataSource : null;
}
set {
// temporarily store the DisplayMember value as it is lost on _internalSource.Dispose()
string _displayMember = DisplayMember;

if (_internalSource != null) _internalSource.Dispose();
_internalSource = null;

if (value != null) {
// restore the lost DisplayMember value
DisplayMember = _displayMember;

if (value != null) {
// wrap the object in a binding source and listen for changes
_bindingSource = new BindingSource(value, String.Empty);
_bindingSource.ListChanged += new ListChangedEventHandler(mBindingSource_ListChanged);
Expand Down