DataGrid.SelectedCells 속성

정의

현재 선택된 셀 목록을 가져옵니다.

public:
 property System::Collections::Generic::IList<System::Windows::Controls::DataGridCellInfo> ^ SelectedCells { System::Collections::Generic::IList<System::Windows::Controls::DataGridCellInfo> ^ get(); };
public System.Collections.Generic.IList<System.Windows.Controls.DataGridCellInfo> SelectedCells { get; }
member this.SelectedCells : System.Collections.Generic.IList<System.Windows.Controls.DataGridCellInfo>
Public ReadOnly Property SelectedCells As IList(Of DataGridCellInfo)

속성 값

현재 선택된 셀 목록입니다.

설명

에 대한 DataGrid세 가지 선택 모드가 있습니다. 선택 모드는 속성을 사용하여 설정됩니다 SelectionUnit . SelectionUnit에 따라 또는 SelectedCellsSelectedItems 는 다음 표에 정의된 대로 선택한 항목의 컬렉션을 포함합니다.

DataGridSelectionUnit SelectedCells SelectedItems
Cell 선택한 셀의 컬렉션 Empty
FullRow 선택한 행의 셀 컬렉션 선택한 행의 컬렉션
CellOrRowHeader 선택한 행의 모든 셀을 포함하여 선택한 셀의 컬렉션 선택한 행의 컬렉션이거나 전체 행이 선택되지 않은 경우 비어 있음

셀을 선택하면 DataGridCell.Selected 이벤트가 발생하고 DataGridCell.IsSelected 속성이 로 true설정되고 셀이 컬렉션에 SelectedCells 추가됩니다.

행을 선택하면 DataGridRow.Selected 이벤트가 발생하고 DataGridRow.IsSelected 속성이 로 true설정되고 행이 컬렉션에 SelectedItems 추가됩니다.

선택 영역이 변경 SelectionChanged 되면 새 선택 영역이나 이전 선택 영역에 행이 포함된 경우 및 SelectedCellsChanged 이벤트가 발생합니다. SelectionChanged 새 선택 영역이나 이전 선택 영역에 셀만 포함되어 있으면 이벤트가 발생하지 않습니다.

적용 대상