콘텐츠로 이동

GridView class

이 콘텐츠는 아직 번역되지 않았습니다.

A scrollable grid of rows with typed columns: column headers, resizing, sorting and row selection over an ItemsView.

Guide: C# Markup reference: Gridview

public sealed class GridView : ScrollableItemsBase, IIndexedSelector, IMultiSelector
name description
GridView() The default constructor.
CellPadding { get; set; } Gets or sets the padding applied to each cell.
HeaderHeight { get; set; } Gets or sets the header row height in DIPs; NaN uses the theme default.
ItemsSource { get; set; } Gets or sets the items source; assign an ItemsView (e.g. from Create ) to display typed rows alongside typed columns.
MaxAutoViewportHeight { get; set; } Gets or sets the maximum height, in DIPs, the rows viewport grows to when the grid sizes to its content.
RowHeight { get; set; } Gets or sets the row height in DIPs; NaN uses the theme default.
SelectedIndex { get; set; } Gets or sets the selected row index, or -1 when nothing is selected.
SelectedIndices { get; } Gets the selected row indices in ascending order.
SelectedItem { get; set; } Gets or sets the selected item, or null when nothing is selected.
SelectedItems { get; } Gets the selected items in ascending index order (read-only, bindable).
SelectionMode { get; set; } Gets or sets the selection mode; multi-selection needs an items source that supports it (e.g. from Create ), otherwise the mode stays Single.
ShowGridLines { get; set; } Gets or sets whether lines are drawn between rows and columns.
SortColumnIndex { get; } Gets the active sorted column index, or -1 when source order is displayed.
SortDirection { get; } Gets the active single-column sort direction.
ZebraStriping { get; set; } Gets or sets whether alternating rows use a second background color (zebra striping).
event ItemDoubleClicked Occurs when a row is double-clicked with the primary mouse button.
event SelectedIndicesChanged Occurs when the set of selected rows changes (multi-select).
event SelectionChanged Occurs when the selected row changes.
event SortChanged Occurs when the active single-column sort changes.
AddColumns<TItem>(…)
ClearSelection() Clears the entire selection.
ClearSort() Clears the active sort and restores current source order.
IsSelected(…) Returns whether the row at index is selected.
ScrollIntoView(…)
SelectAll() Selects every row (multi-selection modes only; no-op otherwise).
SelectRange(…) Selects the inclusive range [start, end], replacing the current selection (multi only).
SetColumns<TItem>(…)
SortByColumn(…) Applies a local sort using the comparer registered on the specified column.
TryGetCellIndexAt(…) Attempts to find the cell (row/column) indices at the specified position in this control’s coordinates. When the position is over the header, returns true with isHeader set and rowIndex set to -1. (2 methods)
TryGetColumnIndexAt(…) Attempts to find the column index at the specified position in this control’s coordinates. Returns true only when the position is over the header or a row area. (2 methods)
TryGetContainer(…) Gets the row currently showing the item at index. False when that item is not realized, which is the normal state of one scrolled out of view.
TryGetItemIndexAt(…) Attempts to find the item (row) index at the specified position in this control’s coordinates. (2 methods)
static readonly CellPaddingProperty
static readonly HeaderHeightProperty
static readonly MaxAutoViewportHeightProperty
static readonly RowHeightProperty
static readonly SelectedIndexProperty
static readonly SelectedItemProperty
static readonly SelectedItemsProperty
static readonly SelectionModeProperty
static readonly ShowGridLinesProperty
static readonly ZebraStripingProperty