protected virtual void HandleListViewSelectedIndexChanged(object sender, EventArgs e)
{
// Prevent recursion
if (this.isChangingIndex)
return;
// If we are bound to a datasource, and only one item is selected,
// tell the currency manager which item is selected.
if (this.ListView.SelectedIndices.Count == 1 && this.CurrencyManager != null) {
try {
this.isChangingIndex = true;
// We can't use the selectedIndex directly, since our listview may be sorted.
// So we have to find the index of the selected object within the original list.
this.CurrencyManager.Position = this.CurrencyManager.List.IndexOf(this.ListView.SelectedObject);
} finally {
this.isChangingIndex = false;
}
}
}