RowCount
GridView.RowCount Property | WinForms Controls | DevExpress Help
This property overrides the BaseView.RowCount property to increment its value in the following cases:
- the new item row is shown at the bottom (the View’s GridOptionsView.NewItemRowPosition property is set to the NewItemRowPosition.Bottom value);
- the new item row is hidden (the View’s GridOptionsView.NewItemRowPosition property is set to the NewItemRowPosition.None value) and a newly added row is being edited.
NoteDetail pattern Views do not contain data and they are never displayed within XtraGrid. So, the RowCount member must not be invoked for these Views. The RowCount member can only be used with real Views that are displayed within the Grid Control. The real Views with which an end-user interacts at runtime can be accessed using the following methods.
- GridControl.MainView – returns the top most View in a grid;
- GridControl.FocusedView – returns the focused View;
- GridControl.DefaultView – returns the currently maximized View;
- the sender parameter of View specific events;
- GetDetailView – returns a detail clone View for a specific master row.
DataRowCount
BaseView.DataRowCount Property | WinForms Controls | DevExpress Help
Note that data rows can be hidden within collapsed groups when data grouping is applied. The DataRowCount property returns the total number of data rows regardless of whether they are within collapsed groups or not. Also, the property’s return value is not always the same as the number of records within the associated data source. When data filtering is applied, the DataRowCount property returns the number of rows that match the filter condition.
NoteDetail pattern Views do not contain data and they are never displayed within XtraGrid. So, the DataRowCount member must not be invoked for these Views. The DataRowCount member can only be used with real Views that are displayed within the Grid Control. The real Views with which an end-user interacts at runtime can be accessed using the following methods.
- GridControl.MainView – returns the top most View in a grid;
- GridControl.FocusedView – returns the focused View;
- GridControl.DefaultView – returns the currently maximized View;
- the sender parameter of View specific events;
- GridView.GetDetailView – returns a detail clone View for a specific master row.
试比较:
Private Sub GridView1_MouseDown(sender As Object, e As MouseEventArgs) Handles GridView1.MouseDown Dim view As GridView = TryCast(sender, GridView) Dim hitInfo As GridHitInfo = view.CalcHitInfo(e.Location) Select Case hitInfo.HitTest Case GridHitTest.Column SelectColumn(view, hitInfo) Case Else ' view.OptionsSelection.MultiSelect = False view.OptionsSelection.MultiSelectMode = GridMultiSelectMode.RowSelect End Select End Sub Private Sub SelectColumn(ByRef View As GridView, ByRef hitinfo As GridHitInfo) '全选列(不排列) View.OptionsSelection.MultiSelect = True View.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CellSelect View.OptionsCustomization.AllowSort = False View.ClearSelection() View.SelectCells(New GridCell(0, hitinfo.Column), New GridCell(View.DataRowCount - 1, hitinfo.Column)) View.OptionsCustomization.AllowSort = True End Sub