I have found somewhat acceptable solution, although not directly corresponding to the verbatium of the question asked.
One possible solution, though, sadly, for some reason deleted by his suggestor, was to use message filters. That, however, led to the path of manually calculating where the mouse click went and essentially substituting the winforms capabilities of translating the mouse events to the process of changing selected item in dropped list of the combo box with some crude crutches on my own. This is the path i shied from.
In the end i settled on "cosmetic" solution, with the idea being substitution of displayed text in combo box for the duration of user's decision-making on the subject of whether or not cancel the change.
So, in the SelectedIndexChanged event i've put the follofing code:
try
{
if (MyDataSets.Current.HasChanges() && !MyDataSets.Current.Name.Equals(cbChosenDataSet.Value))
{
cbChosenDataSet.DropDownStyle = ComboBoxStyle.DropDown;
cbChosenDataSet.Text = MyDataSets.Current.Name + ' ';
Application.DoEvents();
}
else return;
/*
* UserChoseToCancel is set according to user's choice
*/
if (UserChoseToCancel)
cbChosenDataSet.Value = MyDataSets.Current.Name;
else
MyDataSets.SetCurrent(cbChosenDataSet.Value);
/*
* other things
*/
}
catch(Exception e) {/* handling */}
finally
{
cbChosenDataSet.DropDownStyle = ComboBoxStyle.DropDownList;
}
The gist of the idea is this: in DropDown style ComboBox' text can be changed as needed. However, when set to one of the items in the list, a change of selection will occur. To avoid that unneededly, a space is added to the temporary text.
In case cancelling does not occurs, restoring of the style to DropDownList forces the text to be changed to the actual chosen value (which has remained the same).
In case user cancels the change, value of the combo box is set back to the old one. A check in the beginning of the handler stops the event generated by that from being processed further.