void RemoveSelectedRows() { int removed = 0; foreach (var row in listView.SelectedRows) { var name = store.GetValue(row, nameField); if (row == store.RowCount - 1) { store.SetValues(row, valueField, string.Empty, commentField, null); continue; } store.RemoveRow(row - removed++); } SetDocumentDirty(); }
protected sealed override void OnInitialize() { store = OnCreateListStore(); listView = new Xwt.ListView(store) { GridLinesVisible = Xwt.GridLines.Both, SelectionMode = Xwt.SelectionMode.Multiple, }; listView.SelectionChanged += (sender, e) => { if (oldRows != null) { foreach (var row in oldRows) { if (row == store.RowCount - 1) { store.SetValue(row, countField, "*"); } else if (string.IsNullOrWhiteSpace(store.GetValue(row, nameField)) && !string.IsNullOrEmpty(store.GetValue(row, valueField))) { store.SetValue(row, countField, "!"); } else { store.SetValue(row, countField, string.Empty); } } } oldRows = listView.SelectedRows; foreach (var row in oldRows) { store.SetValue(row, countField, "▶"); } }; listView.ButtonPressed += OnButtonPress; listView.Show(); AddListViewColumns(listView.Columns); }