public override void SelectObject(object modelObject, bool setFocus)
{
// Without a data source, we can't do this.
if (this.VirtualListDataSource == null)
return;
// Check that the object is in the list (plus not all data sources can locate objects)
int index = this.VirtualListDataSource.GetObjectIndex(modelObject);
if (index < 0 || index >= this.VirtualListSize)
return;
// If the given model is already selected, don't do anything else (prevents an flicker)
if (this.SelectedIndices.Count == 1 && this.SelectedIndices[0] == index)
return;
// Finally, select the row
this.SelectedIndices.Clear();
this.SelectedIndices.Add(index);
if (setFocus)
this.SelectedItem.Focused = true;
}