void item_OnSelectedChange(ListViewItem sender, bool isSelected) { if (isSelected && sender != SelectedPanel) { SelectedPanel = sender; foreach (Panel item in this.Panels) { if (!(item is ListViewItem)) continue; ListViewItem listItem = item as ListViewItem; if (listItem != SelectedPanel) listItem.SetIsSelected(false); } } }
public override void MouseDown(OpenTK.Input.MouseButtonEventArgs e) { base.MouseDown(e); Panel HighestItem = this.ScrollPanel.GetHighestChildAtPos(new OpenTK.Vector2(e.X, e.Y)); if (!HighestItem) { foreach (var item in Panels) { if (item is ListViewItem) { ListViewItem listItem = item as ListViewItem; listItem.SetIsSelected(false); } } this.SelectedPanel = null; } }