+ wxListView * const list = GetListView();
+
+ // If imageList presence has changed, we update the list control style
+ if ( (imageList != NULL) != (GetImageList() != NULL) )
+ {
+ // Preserve the selection which is lost when changing the mode
+ const int oldSel = GetSelection();
+
+ // Update the style to use icon view for images, list view otherwise
+ long style = list->GetWindowStyle() & ~wxLC_MASK_TYPE;
+ if ( imageList )
+ {
+ style |= wxLC_ICON;
+ }
+ else // no image list
+ {
+ style |= wxLC_LIST;
+ }
+
+ list->SetWindowStyleFlag(style);
+
+ // Restore selection
+ if ( oldSel != wxNOT_FOUND )
+ SetSelection(oldSel);
+ }
+
+ list->SetImageList(imageList, wxIMAGE_LIST_NORMAL);