ListViewInsertedEventArgs.KeepInInsertMode 속성

정의

사용자의 입력 값이 InsertItemTemplate 템플릿 내에 있는 컨트롤에 대해 유지되는지 여부를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool KeepInInsertMode { bool get(); void set(bool value); };
public bool KeepInInsertMode { get; set; }
member this.KeepInInsertMode : bool with get, set
Public Property KeepInInsertMode As Boolean

속성 값

Boolean

사용자의 입력 값이 InsertItemTemplate 템플릿 내에 있는 컨트롤에 대해 유지되면 true이고, 컨트롤의 기본값으로 대체되면 false입니다. 기본값은 false입니다.

예제

다음 예제에서는 사용 하는 방법의 KeepInInsertMode 삽입 작업 중에 오류가 발생 하는 경우 사용자가 입력 한 값을 유지 하는 속성입니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 ListViewInsertedEventArgs 클래스입니다.

void ContactsListView_ItemInserted(Object sender, ListViewInsertedEventArgs e)
{
  if (e.Exception != null)
  {
    if (e.AffectedRows == 0)
    {
      e.KeepInInsertMode = true;
      Message.Text = "An exception occurred inserting the new Contact. " +
        "Please verify your values and try again.";
    }
    else
      Message.Text = "An exception occurred inserting the new Contact. " +
        "Please verify the values in the newly inserted item.";

    e.ExceptionHandled = true;
  }
}
Sub ContactsListView_ItemInserted(ByVal sender As Object, ByVal e As ListViewInsertedEventArgs)

  If e.Exception IsNot Nothing Then

    If e.AffectedRows = 0 Then
      e.KeepInInsertMode = True
      Message.Text = "An exception occurred inserting the new Contact. " & _
        "Please verify your values and try again."
    Else
      Message.Text = "An exception occurred inserting the new Contact. " & _
        "Please verify the values in the newly inserted item."
    End If

    e.ExceptionHandled = True
  End If
End Sub

설명

기본적으로 ListView 컨트롤에서 컨트롤의 값을 다시 설정 된 InsertItemTemplate 삽입 작업 후 기본값으로 템플릿. 따라서 사용자가 삽입 될 새 항목에 대 한 값을 추가할 수 있습니다. 삽입 작업 중 예외가 발생 하는 경우 유지할 수 있습니다 합니다 ListView 컨트롤을 설정 하 여 삽입 모드로 합니다 KeepInInsertMode 속성을 true합니다. 내에 있는 컨트롤에 대 한 항목을 삽입할 이전 시도에서 값이 유지 된 InsertItemTemplate 템플릿.

적용 대상

추가 정보