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