Class DataGridCopyPasteController
Provides the base implementation for Clipboard operations in SfDataGrid.
Inheritance
Namespace: Syncfusion.Maui.DataGrid
Assembly: Syncfusion.Maui.DataGrid.dll
Syntax
public class DataGridCopyPasteController : Object
Constructors
DataGridCopyPasteController(SfDataGrid)
Initializes a new instance of the class.
Declaration
public DataGridCopyPasteController(SfDataGrid dataGrid)
Parameters
Type | Name | Description |
---|---|---|
SfDataGrid | dataGrid | The instance of SfDataGrid. |
Fields
dataGrid
Gets or sets an instance of SfDataGrid .
Declaration
protected SfDataGrid dataGrid
Field Value
Type |
---|
SfDataGrid |
leftMostColumnIndex
Gets or sets the left most selected column index of the DataGrid while copying with cell selection.
Declaration
protected int leftMostColumnIndex
Field Value
Type |
---|
System.Int32 |
rightMostColumnIndex
Gets or sets the right most selected column index of the DataGrid while copying with cell selection.
Declaration
protected int rightMostColumnIndex
Field Value
Type |
---|
System.Int32 |
Methods
CanConvertToType(Object, ref Type)
Checks whether the type of copied cell value is compatible with the type of the cell content to be pasted into.
Declaration
protected bool CanConvertToType(object value, ref Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The corresponding value can be compatible with paste cell type. |
System.Type | type | Contains type of selected column. |
Returns
Type | Description |
---|---|
System.Boolean | Returns true if the copied value type is compatible with paste cell value type; otherwise, false. |
Copy()
Copies the selected rows or cells from the SfDataGrid to the clipboard.
Declaration
public void Copy()
Remarks
This method is invoked when the Ctrl+C key is pressed.
CopyRowsToClipboard(Int32, Int32)
Copies the rows to the clipboard based on the specified start and end record index.
Declaration
public void CopyRowsToClipboard(int startRecordIndex, int endRecordIndex)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | startRecordIndex | The start index of the record to copy rows to clipboard. |
System.Int32 | endRecordIndex | The end index of the record to copy rows to clipboard. |
Cut()
Copies the selected rows or cells and assigns a default, null, or empty value to them.
Declaration
public void Cut()
Remarks
This method is invoked when the Ctrl+X key is pressed.
GetPropertyType(Object, DataGridColumn)
Gets the corresponding property type for the specified row data and column.
Declaration
protected virtual Type GetPropertyType(object rowData, DataGridColumn column)
Parameters
Type | Name | Description |
---|---|---|
System.Object | rowData | The corresponding row data to get property type. |
DataGridColumn | column | The corresponding column to get property type. |
Returns
Type | Description |
---|---|
System.Type | Returns the corresponding property type. |
OnClearCellsByCut(ObservableCollection<Object>)
Invoked when the cut operation is executed on rows or cells in the SfDataGrid.
Declaration
protected virtual void OnClearCellsByCut(ObservableCollection<object> selections)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ObjectModel.ObservableCollection<System.Object> | selections | Contains the collection of selected records or cells based on the selection unit. |
OnCommitValue(Object, DataGridColumn, IPropertyAccessProvider, Object)
Commits the value for the specified row data and column with the corresponding changed value.
Declaration
protected virtual void OnCommitValue(object rowData, DataGridColumn column, IPropertyAccessProvider provider, object changedValue)
Parameters
Type | Name | Description |
---|---|---|
System.Object | rowData | The corresponding row data to commit value. |
DataGridColumn | column | The corresponding column to commit value. |
IPropertyAccessProvider | provider | The corresponding provider to commit value. |
System.Object | changedValue | The corresponding changed value to commit. |
OnCopyCell(Object, DataGridColumn, ref StringBuilder)
Copies the particular cell value for the specified column and record.
Declaration
protected virtual void OnCopyCell(object record, DataGridColumn column, ref StringBuilder text)
Parameters
Type | Name | Description |
---|---|---|
System.Object | record | The corresponding record to copy the cell. |
DataGridColumn | column | The corresponding column to copy the cell. |
System.Text.StringBuilder | text | The corresponding copied value is append to the reference parameter. |
OnCopyCellRow(List<SelectedCellsInfo>, ref StringBuilder)
Executes the copy operation for a specifically selected cell.
Declaration
protected virtual void OnCopyCellRow(List<SelectedCellsInfo> row, ref StringBuilder text)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.List<SelectedCellsInfo> | row | The corresponding row to process copy operation. |
System.Text.StringBuilder | text | The corresponding copied value is append to the reference parameter. |
OnCopyCells(DataGridSelectedCellCollection, StringBuilder)
Perform the copy operation for the specified collection of cells.
Declaration
protected virtual void OnCopyCells(DataGridSelectedCellCollection selectedCells, StringBuilder text)
Parameters
Type | Name | Description |
---|---|---|
DataGridSelectedCellCollection | selectedCells | The collection of selected cells to perform copy operation. |
System.Text.StringBuilder | text | The corresponding copied value is append to the StringBuilder parameter. |
OnCopyRow(Object, ref StringBuilder)
Executes a copy operation for the specific record, preparing it for clipboard use.
Declaration
protected virtual void OnCopyRow(object record, ref StringBuilder text)
Parameters
Type | Name | Description |
---|---|---|
System.Object | record | The corresponding record to process copy operation. |
System.Text.StringBuilder | text | The corresponding copied value is append to the reference parameter. |
OnCopyRows(ObservableCollection<Object>, ref StringBuilder)
Performs the copy operation for the specified collection of records.
Declaration
protected virtual void OnCopyRows(ObservableCollection<object> records, ref StringBuilder text)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ObjectModel.ObservableCollection<System.Object> | records | The collection of record to process copy operation. |
System.Text.StringBuilder | text | The corresponding copied value is append to the reference parameter. |
OnCopyTextToClipboard(DataGridSelectedCellCollection, Boolean)
Invoked to initiate the copy operation for the collection of selected cells, transferring them to the clipboard for cell selection.
Declaration
protected virtual void OnCopyTextToClipboard(DataGridSelectedCellCollection selectedCells, bool cut)
Parameters
Type | Name | Description |
---|---|---|
DataGridSelectedCellCollection | selectedCells | The collection of selected cells to initialize copy operation. |
System.Boolean | cut | Indicates whether the cut operation is performed. |
OnCopyTextToClipboard(ObservableCollection<Object>, Boolean)
Copies the specified collection of records to the clipboard for row selection.
Declaration
protected virtual void OnCopyTextToClipboard(ObservableCollection<object> records, bool cut)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ObjectModel.ObservableCollection<System.Object> | records | The collection of records to initialize copy operation. |
System.Boolean | cut | Indicates whether the cut operation is performed. |
OnCutRowCell(Object, DataGridColumn)
Invoked when the cut operation is performed for the specified row data and column.
Declaration
protected virtual void OnCutRowCell(object rowData, DataGridColumn column)
Parameters
Type | Name | Description |
---|---|---|
System.Object | rowData | Contains the row data of the selected record to perform cut operation. |
DataGridColumn | column | The corresponding column of the selected record to perform cut operation. |
OnPasteTextToCell()
Invoked when the clipboard content is divided into multiple cells to perform a paste operation for the cell selection.
Declaration
protected virtual void OnPasteTextToCell()
OnPasteTextToRow()
Invoked when the clipboard content is divided into multiple rows for executing the paste operation during row selection.
Declaration
protected virtual void OnPasteTextToRow()
OnPasteToCell(Object, DataGridColumn, Object)
Pastes the copied cell value into the selected cell.
Declaration
protected virtual void OnPasteToCell(object record, DataGridColumn column, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | record | Contains the record of the selected cell. |
DataGridColumn | column | Contains the corresponding column of the selected cell. |
System.Object | value | Contains copied cell value to paste. |
OnPasteToCells(Object)
Invoked when the paste operation is performed to each cell of the clipboard copied cells to selected cells in SfDataGrid.
Declaration
protected virtual void OnPasteToCells(object clipBoardRows)
Parameters
Type | Name | Description |
---|---|---|
System.Object | clipBoardRows | Contains the copied clipboard content to paste cells. |
OnPasteToRow(Object, Object)
Invoked when the copied row is splitted into cells to perform paste operation for the specified clipboard content and selected records.
Declaration
protected virtual void OnPasteToRow(object clipBoardContent, object selectedRecords)
Parameters
Type | Name | Description |
---|---|---|
System.Object | clipBoardContent | Contains the copied record to paste row. |
System.Object | selectedRecords | Contains the selected record to paste row. |
OnPasteToRows(Object)
Invoked when the paste operation is performed to each row of the clipboard copied rows to SfDataGrid.
Declaration
protected virtual void OnPasteToRows(object clipBoardRows)
Parameters
Type | Name | Description |
---|---|---|
System.Object | clipBoardRows | Contains the copied clipboard content to paste rows. |
Paste()
Pastes the clipboard's copied content into the selected rows or cells in the SfDataGrid.
Declaration
public void Paste()
Remarks
This method is invoked when the Ctrl+V key is pressed.