private void listView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (_inSelectionAlready)
return;
if (!_intentionallyChangingSelection)//yes, having painful phantom selections when the cursor leaves this control
{
_listView.SelectedIndices.Clear();
}
_inSelectionAlready = true;
try
{
if (_listView.SelectedItems.Count == 0)
{
InvokePageSelectedChanged(null);
}
else
{
Page page = _listView.SelectedItems[0].Tag as Page;
if(!CanSelect)
{
//leads to two apparent clicks... (hence the _mouseDidGoDown thing)
_listView.SelectedIndices.Clear();
}
InvokePageSelectedChanged(page);
}
}
finally
{
_inSelectionAlready = false;
}
}