private void VisualListViewAdvanced1_SelectedIndexChanged(object source, ListViewClickEventArgs e) { int _columnIndex; if (visualListView.ColumnIndex == -1) { // Clicked outside of column bounds. return; } else { _columnIndex = visualListView.ColumnIndex; } int _rowIndex = e.ItemIndex; string _column = visualListView.Columns[_columnIndex].Text; string _rowItem = visualListView.Items[_rowIndex].Text; string _rowSub = visualListView.Items[_rowIndex].SubItems[_columnIndex].Text; bool _rowChecked = visualListView.Items[_rowIndex].Checked; bool _columnChecked = visualListView.Columns[_columnIndex].Checked; bool _cellChecked = visualListView.Items[_rowIndex].SubItems[_columnIndex].Checked; StringBuilder _selectedIndex = new StringBuilder(); _selectedIndex.AppendLine($"Column: [{_columnIndex}] - Text: {_column}, - Checked: {_columnChecked}"); _selectedIndex.AppendLine($"Row: [{_rowIndex}] - Text: {_rowItem}, - Checked: {_rowChecked}"); _selectedIndex.AppendLine(Environment.NewLine); _selectedIndex.AppendLine($"Cell: Text: {_rowSub}, - Checked: {_cellChecked}"); MessageBox.Show(_selectedIndex.ToString(), Application.ProductName); }
private void VisualListViewColumnClickedEvent(object source, ListViewClickEventArgs e) { if (e.ColumnIndex == 0) { foreach (VisualListViewItem _item in visualListView.Items) { _item.Checked = visualListView.Columns[0].Checked; } } }
private void VisualListViewAdvanced1_SelectedIndexChanged(object source, ListViewClickEventArgs e) { int _columnIndex = visualListViewAdvanced1.ColumnIndex; int _rowIndex = e.ItemIndex; string _column = visualListViewAdvanced1.Columns[_columnIndex].Text; string _rowItem = visualListViewAdvanced1.Items[_rowIndex].Text; string _rowSub = visualListViewAdvanced1.Items[_rowIndex].SubItems[_columnIndex].Text; StringBuilder _selectedIndex = new StringBuilder(); _selectedIndex.AppendLine($"Column: [{_columnIndex}] - Text: {_column}"); _selectedIndex.AppendLine($"Row: [{_rowIndex}] - Text: {_rowItem}"); _selectedIndex.AppendLine(Environment.NewLine); _selectedIndex.AppendLine($"Cell: Text: {_rowSub}"); MessageBox.Show(_selectedIndex.ToString(), Application.ProductName); }