The ItemSelecting event was bugged and was raised instead of ItemDeselecting when an item is being deselected. Here you can download yet another version of the control:
https://mindfusion.eu/_pln_trial/MindFusion.Scheduling.Wpf.2.1e.zipThe pair of events should now be raised as expected.
However, when you attempt to select an item when another item is selected, first the selected item gets deselected, then the second item gets selected. Therefore the ItemDeselecting event is raised first and you are not able to determine then whether the item is being deselected due to another item being selected or due to clicking on an empty cell. A possible way to implement your scenario in this case could be the following:
Declare a variable to store the last deselected item. If an item is selected, clear the variable. In the ItemSelectionComplete you can inspect the value of this variable and, if not null, restore the selection of the last deselected item. Not the most elegant approach but it works.
private void c_ItemSelecting(object sender, ItemConfirmEventArgs e)
{
if (c.ItemSelection.Items.Length > 0)
e.Confirm = false;
lastDeselectedItem = null;
}
private void c_ItemDeselecting(object sender, ItemConfirmEventArgs e)
{
lastDeselectedItem = e.Item;
}
void c_ItemSelectionComplete(object sender, EventArgs e)
{
if (lastDeselectedItem != null)
c.ItemSelection.Add(lastDeselectedItem);
}
private Item lastDeselectedItem = null;
There is an additional check in the ItemSelecting event, which prevents more than one item to be selected at the same time with the CTRL key. I am not sure if this is a requirement in your case.
Additionally, the ItemCloning event is fixed in the above version. It should now be raised before the item is actually cloned and will provide as argument the item being cloned, instead of the clone.
Regards,
Meppy