void AddListItemForPage(PropertyPage page) { int imageIndex = 0; Image image = page.Image; if (image != null) { imageList.Images.Add(image); imageIndex = imageList.Images.Count - 1; } ListViewItem item = new ListViewItem(page.Text, imageIndex); item.Tag = page; listView.Items.Add(item); }
private void listView_SelectedIndexChanged(object sender, System.EventArgs e) { if (_activePage != null) _activePage.Visible = false; if (listView.SelectedItems.Count != 0) { ListViewItem selectedItem = listView.SelectedItems[0]; PropertyPage page = (PropertyPage)selectedItem.Tag; _activePage = page; } if (_activePage != null) { _activePage.Visible = true; _activePage.OnSetActive(); } }