public void TestConstructor() { using(ContainerListView listView = new ContainerListView()) { // Let the control create its window handle listView.CreateControl(); listView.Columns.Add("Numeric"); listView.Columns.Add("Spelled"); listView.Columns.Add("Nonsense"); addRow(listView, "1", "One"); addRow(listView, "2", "Two"); addRow(listView, "3", "Three"); using(CheckBox checkBox = new CheckBox()) { listView.EmbeddedControls.Add(new ListViewEmbeddedControl(checkBox, 2, 0)); listView.EmbeddedControls.Clear(); listView.Refresh(); ListViewEmbeddedControl embeddedControl = new ListViewEmbeddedControl( checkBox, 2, 0 ); listView.EmbeddedControls.Add(embeddedControl); listView.EmbeddedControls.Remove(embeddedControl); listView.Refresh(); } } }
public void TestConstructor() { using (ContainerListView listView = new ContainerListView()) { // Let the control create its window handle listView.CreateControl(); listView.Columns.Add("Numeric"); listView.Columns.Add("Spelled"); listView.Columns.Add("Nonsense"); addRow(listView, "1", "One"); addRow(listView, "2", "Two"); addRow(listView, "3", "Three"); using (CheckBox checkBox = new CheckBox()) { listView.EmbeddedControls.Add(new ListViewEmbeddedControl(checkBox, 2, 0)); listView.EmbeddedControls.Clear(); listView.Refresh(); ListViewEmbeddedControl embeddedControl = new ListViewEmbeddedControl( checkBox, 2, 0 ); listView.EmbeddedControls.Add(embeddedControl); listView.EmbeddedControls.Remove(embeddedControl); listView.Refresh(); } } }
/// <summary>Adds a row to a control container list view</summary> /// <param name="listView">List view control the row will be added to</param> /// <param name="columns">Values that will appear in the individual columns</param> private void addRow(ContainerListView listView, params string[] columns) { listView.Items.Add(new ListViewItem(columns)); }