C#: Как Вы редактируете объекты и подэлементы в listview?

ActionScript: процедурный / ООП

function f(n) {
    var result = n>1 ? arguments.callee(n-1)*n : 1;
    return result;
}
// function call
f(3);
29
задан Jay Bazuzi 24 January 2009 в 00:43
поделиться

2 ответа

If you're looking for "in-place" editing of a ListView's contents (specifically the subitems of a ListView in details view mode), you'll need to implement this yourself, or use a third-party control.

By default, the best you can achieve with a "standard" ListView is to set it's LabelEdit property to true to allow the user to edit the text of the first column of the ListView (assuming you want to allow a free-format text edit).

Some examples (including full source-code) of customized ListView's that allow "in-place" editing of sub-items are:

C# Editable ListView
In-place editing of ListView subitems

24
ответ дан 28 November 2019 в 01:23
поделиться

Извините, у меня недостаточно репутации, иначе я бы прокомментировал ответ CraigTP .

Я нашел решение по 1-й ссылке - C # Editable ListView , довольно простое в использовании. Общая идея состоит в следующем:

  • идентифицировать SubItem , который был выбран, и наложить TextBox с текстом SubItem поверх SubItem
  • сделать это TextBox focus
  • изменить текст SubItem на текст TextBox , когда TextBox теряет фокус

Какой способ обхода, казалось бы, простой операции: - |

8
ответ дан 28 November 2019 в 01:23
поделиться
Другие вопросы по тегам:

Похожие вопросы: