DataRowView 클래스

정의

DataRow의 사용자 지정 뷰를 나타냅니다.

public ref class DataRowView : System::ComponentModel::ICustomTypeDescriptor, System::ComponentModel::IDataErrorInfo, System::ComponentModel::IEditableObject, System::ComponentModel::INotifyPropertyChanged
public ref class DataRowView : System::ComponentModel::ICustomTypeDescriptor, System::ComponentModel::IDataErrorInfo, System::ComponentModel::IEditableObject
public class DataRowView : System.ComponentModel.ICustomTypeDescriptor, System.ComponentModel.IDataErrorInfo, System.ComponentModel.IEditableObject, System.ComponentModel.INotifyPropertyChanged
public class DataRowView : System.ComponentModel.ICustomTypeDescriptor, System.ComponentModel.IDataErrorInfo, System.ComponentModel.IEditableObject
type DataRowView = class
    interface ICustomTypeDescriptor
    interface IDataErrorInfo
    interface IEditableObject
    interface INotifyPropertyChanged
type DataRowView = class
    interface ICustomTypeDescriptor
    interface IEditableObject
    interface IDataErrorInfo
type DataRowView = class
    interface ICustomTypeDescriptor
    interface IEditableObject
    interface IDataErrorInfo
    interface INotifyPropertyChanged
Public Class DataRowView
Implements ICustomTypeDescriptor, IDataErrorInfo, IEditableObject, INotifyPropertyChanged
Public Class DataRowView
Implements ICustomTypeDescriptor, IDataErrorInfo, IEditableObject
상속
DataRowView
구현

예제

다음 예제에서는 속성을 사용하여 RowVersion 에서 행의 상태를 확인합니다 DataRowView. (를 사용하는 다른 예제는 DataRowView를 참조하세요RowFilter.)

private static void DemonstrateRowVersion()
{
    // Create a DataTable with one column.
    DataTable table = new DataTable("Table");
    DataColumn column = new DataColumn("Column");
    table.Columns.Add(column);

    // Add ten rows.
    DataRow row;
    for (int i = 0; i < 10; i++)
    {
        row = table.NewRow();
        row["Column"] = "item " + i;
        table.Rows.Add(row);
    }

    table.AcceptChanges();
    // Create a DataView with the table.
    DataView view = new DataView(table);

    // Change one row's value:
    table.Rows[1]["Column"] = "Hello";

    // Add one row:
    row = table.NewRow();
    row["Column"] = "World";
    table.Rows.Add(row);

    // Set the RowStateFilter to display only added
    // and modified rows.
    view.RowStateFilter = DataViewRowState.Added |
        DataViewRowState.ModifiedCurrent;

    // Print those rows. Output includes "Hello" and "World".
    PrintView(view, "ModifiedCurrent and Added");

    // Set filter to display only originals of modified rows.
    view.RowStateFilter = DataViewRowState.ModifiedOriginal;
    PrintView(view, "ModifiedOriginal");

    // Delete three rows.
    table.Rows[1].Delete();
    table.Rows[2].Delete();
    table.Rows[3].Delete();

    // Set the RowStateFilter to display only deleted rows.
    view.RowStateFilter = DataViewRowState.Deleted;
    PrintView(view, "Deleted");

    // Set filter to display only current rows.
    view.RowStateFilter = DataViewRowState.CurrentRows;
    PrintView(view, "Current");

    // Set filter to display only unchanged rows.
    view.RowStateFilter = DataViewRowState.Unchanged;
    PrintView(view, "Unchanged");

    // Set filter to display only original rows.
    // Current values of unmodified rows are also returned.
    view.RowStateFilter = DataViewRowState.OriginalRows;
    PrintView(view, "OriginalRows");
}

private static void PrintView(DataView view, string label)
{
    Console.WriteLine("\n" + label);
    for (int i = 0; i < view.Count; i++)
    {
        Console.WriteLine(view[i]["Column"]);
        Console.WriteLine("DataViewRow.RowVersion: {0}",
            view[i].RowVersion);
    }
}
Private Sub DemonstrateRowVersion()
    Dim i As Integer
    ' Create a DataTable with one column.
    Dim table As New DataTable("Table")
    Dim column As New DataColumn("Column")
    table.Columns.Add(column)

    ' Add ten rows.
    Dim row As DataRow
    For i = 0 To 9
        row = table.NewRow()
        row("Column") = "item " + i.ToString()
        table.Rows.Add(row)
    Next i
    table.AcceptChanges()

    ' Create a DataView with the table.
    Dim view As New DataView(table)

    ' Change one row's value:
    table.Rows(1)("Column") = "Hello"

    ' Add one row:
    row = table.NewRow()
    row("Column") = "World"
    table.Rows.Add(row)

    ' Set the RowStateFilter to display only added and modified rows.
    view.RowStateFilter = _
       DataViewRowState.Added Or DataViewRowState.ModifiedCurrent

    ' Print those rows. Output includes "Hello" and "World".
    PrintView(view, "ModifiedCurrent and Added")

    ' Set filter to display only originals of modified rows.
    view.RowStateFilter = DataViewRowState.ModifiedOriginal
    PrintView(view, "ModifiedOriginal")

    ' Delete three rows.
    table.Rows(1).Delete()
    table.Rows(2).Delete()
    table.Rows(3).Delete()

    ' Set the RowStateFilter to display only deleted rows.
    view.RowStateFilter = DataViewRowState.Deleted
    PrintView(view, "Deleted")

    ' Set filter to display only current rows.
    view.RowStateFilter = DataViewRowState.CurrentRows
    PrintView(view, "Current")

    ' Set filter to display only unchanged rows.
    view.RowStateFilter = DataViewRowState.Unchanged
    PrintView(view, "Unchanged")

    ' Set filter to display only original rows.
    ' Current values of unmodified rows are also returned.
    view.RowStateFilter = DataViewRowState.OriginalRows
    PrintView(view, "OriginalRows")
End Sub

Private Sub PrintView(ByVal view As DataView, ByVal label As String)
    Console.WriteLine(ControlChars.Cr + label)
    Dim i As Integer
    For i = 0 To view.Count - 1
        Console.WriteLine(view(i)("Column"))
        Console.WriteLine("DataRowView.RowVersion: {0}", _
            view(i).RowVersion)
    Next i
End Sub

설명

컨트롤과 같이 DataGrid 데이터가 표시될 때마다 각 행의 버전 하나만 표시할 수 있습니다. 표시된 행은 입니다 DataRowView.

DataRowView 에는 , , OriginalCurrentProposed의 네 가지 Default버전 상태 중 하나가 있을 수 있습니다.

에서 를 호출하면 BeginEditDataRow편집된 모든 값이 값이 Proposed 됩니다. CancelEdit 또는 EndEdit 가 호출될 때까지 행에는 Original 및 버전이 있습니다Proposed. 가 호출되면 CancelEdit 제안된 버전이 삭제되고 값이 로 되돌아갑니다 Original. 가 호출되면 EndEditDataRowView 더 이상 버전이 Proposed 없습니다. 대신 제안된 값이 현재 값이 됩니다. 기본값은 기본값이 정의된 열이 있는 행에서만 사용할 수 있습니다.

속성

DataView

이 행이 속한 DataView를 가져옵니다.

IsEdit

행이 편집 모드인지 여부를 나타냅니다.

IsNew

DataRowView가 새 행인지 여부를 나타냅니다.

Item[Int32]

지정된 열에 있는 값을 가져오거나 설정합니다.

Item[String]

지정된 열에 있는 값을 가져오거나 설정합니다.

Row

표시되는 DataRow를 가져옵니다.

RowVersion

DataRow에 대한 현재 버전 설명을 가져옵니다.

메서드

BeginEdit()

편집 프로시저를 시작합니다.

CancelEdit()

편집 프로시저를 취소합니다.

CreateChildView(DataRelation)

지정된 자식 DataView이 있는 자식 DataTable에 대한 DataRelation를 반환합니다.

CreateChildView(DataRelation, Boolean)

지정된 DataView 및 부모가 있는 자식 DataTable에 대한 DataRelation를 반환합니다.

CreateChildView(String)

지정된 자식 DataView 이름이 있는 자식 DataTable에 대한 DataRelation를 반환합니다.

CreateChildView(String, Boolean)

지정된 DataView 이름 및 부모가 있는 자식 DataTable에 대한 DataRelation를 반환합니다.

Delete()

행을 삭제합니다.

EndEdit()

기본 DataRow에 대한 변경 내용을 커밋하고 BeginEdit()로 시작된 편집 세션을 끝냅니다. CancelEdit()를 사용하여 DataRow에 대한 변경 내용을 취소합니다.

Equals(Object)

현재 DataRowView가 지정된 개체와 같은지 여부를 나타내는 값을 가져옵니다.

GetHashCode()

DataRow 개체의 해시 코드를 반환합니다.

GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

이벤트

PropertyChanged

DataRowView 속성이 변경되면 발생하는 이벤트입니다.

명시적 인터페이스 구현

ICustomTypeDescriptor.GetAttributes()

해당 구성 요소 인스턴스에 대한 사용자 지정 특성의 컬렉션을 반환합니다.

ICustomTypeDescriptor.GetClassName()

해당 구성 요소 인스턴스의 클래스 이름을 반환합니다.

ICustomTypeDescriptor.GetComponentName()

해당 구성 요소 인스턴스의 이름을 반환합니다.

ICustomTypeDescriptor.GetConverter()

해당 구성 요소 인스턴스에 대한 형식 변환기를 반환합니다.

ICustomTypeDescriptor.GetDefaultEvent()

해당 구성 요소 인스턴스의 기본 이벤트를 반환합니다.

ICustomTypeDescriptor.GetDefaultProperty()

해당 구성 요소 인스턴스의 기본 속성을 반환합니다.

ICustomTypeDescriptor.GetEditor(Type)

해당 구성 요소 인스턴스에 대한 지정된 형식의 편집기를 반환합니다.

ICustomTypeDescriptor.GetEvents()

해당 구성 요소 인스턴스의 이벤트를 반환합니다.

ICustomTypeDescriptor.GetEvents(Attribute[])

지정된 특성이 있는 구성 요소의 이 인스턴스에 대한 이벤트를 반환합니다.

ICustomTypeDescriptor.GetProperties()

해당 구성 요소 인스턴스의 속성을 반환합니다.

ICustomTypeDescriptor.GetProperties(Attribute[])

지정된 특성이 있는 구성 요소의 이 인스턴스에 대한 속성을 반환합니다.

ICustomTypeDescriptor.GetPropertyOwner(PropertyDescriptor)

지정된 속성 설명자가 설명하는 속성이 포함된 개체를 반환합니다.

IDataErrorInfo.Error

개체에 대한 유효성 검사 오류를 설명하는 메시지를 가져옵니다.

IDataErrorInfo.Item[String]

지정된 이름의 속성에 대한 오류 메시지를 가져옵니다.

적용 대상

스레드 보안

이 형식은 다중 스레드 읽기 작업에 안전합니다. 모든 쓰기 작업을 동기화해야 합니다.

추가 정보