GridView.IHandler

References
public interface GridView.IHandler : Grid.IHandler
Handler interface for the GridView.

Properties

AllowColumnReordering

bool AllowColumnReordering { get; set; }
Gets or sets a value indicating whether the user can re-order columns
inherited fromGrid.IHandler

AllowDrop

bool AllowDrop { get; set; }
Gets or sets a value indicating whether this control can serve as drop target.
inherited fromControl.IHandler

AllowEmptySelection

bool AllowEmptySelection { get; set; }
Gets or sets a value indicating that the user can clear the selection.
inherited fromGrid.IHandler
Remarks: When true, the user can deselect the item by cmd/ctrl+click the last selected row, or by clicking on the empty space in the Grid. Some platforms may have empty space to the right, and some only have space at the bottom. When false, this setting will make it so the user cannot deselect the last selected item, and the control will initially select the first item when setting the DataStore property. This does not affect the ability to clear the selection programmatically.

AllowMultipleSelection

bool AllowMultipleSelection { get; set; }
Gets or sets a value indicating whether the user can select multiple rows
inherited fromGrid.IHandler

BackgroundColor

Color BackgroundColor { get; set; }
Gets or sets the color for the background of the control
inherited fromControl.IHandler
Remarks: Note that on some platforms (e.g. Mac), setting the background color of a control can change the performance characteristics of the control and its children, since it must enable layers to do so.
The color of the background.

ContextMenu

ContextMenu ContextMenu { get; set; }
Gets or sets the context menu to show when the user right clicks or presses the menu key
inherited fromIContextMenuHost

Cursor

Cursor Cursor { get; set; }
Gets or sets the type of cursor to use when the mouse is hovering over the control
inherited fromControl.IHandler

DataStore

#
IEnumerable<object> DataStore { get; set; }
Gets or sets the data store for the items to show in the grid.

Enabled

bool Enabled { get; set; }
Gets or sets a value indicating whether this Control is enabled and accepts user input.
inherited fromControl.IHandler
Remarks: Typically when a control is disabled, the user cannot do anything with the control (including for example, selecting text in a text control). Certain controls can have a 'Read Only' mode, such as TextBox.ReadOnly which allows the user to select text, but not change its contents.
true if enabled; otherwise, false.

GridLines

GridLines GridLines { get; set; }
Gets or sets the style of grid lines to show between columns and rows
inherited fromGrid.IHandler

HasFocus

bool HasFocus { get; }
Gets a value indicating whether this instance has the keyboard input focus.
inherited fromControl.IHandler

ID

string ID { get; set; }
Gets or sets an ID for the widget
inherited fromWidget.IHandler
Remarks: Some platforms may use this to identify controls (e.g. web)

IsEditing

bool IsEditing { get; }
Gets a value indicating that the current cell is in edit mode.
inherited fromGrid.IHandler

IsMouseCaptured

bool IsMouseCaptured { get; }
Gets a value indicating this control currently has mouse capture
inherited fromControl.IHandler
Remarks: Mouse capture can happen during a handled MouseDown event until MouseUp, or it can be captured explicitly via Control.IHandler.CaptureMouse().

Location

Point Location { get; }
Gets the location of the control as positioned by the container
inherited fromControl.IHandler
Remarks: A control's location is set by the container. This can be used to determine where the control is for overlaying floating windows, menus, etc.
The current location of the control

NativeHandle

nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
inherited fromWidget.IHandler

RowHeight

int RowHeight { get; set; }
Gets or sets the height for each row in the grid
inherited fromGrid.IHandler

SelectedItems

#
IEnumerable<object> SelectedItems { get; }
Gets an enumeration of the currently selected items

ShowHeader

bool ShowHeader { get; set; }
Gets or sets a value indicating that the header should be shown
inherited fromGrid.IHandler

Size

Size Size { get; set; }
Gets or sets the size of the control. Use -1 to specify auto sizing for either the width and/or height.
inherited fromControl.IHandler
Remarks: Setting the size of controls is entirely optional as most controls will size themselves appropriately. When specifying a size, it will be used as the desired size of the control. The container will reposition and resize the control depending on the available size. For a Window, it is preferred to set the Container.ClientSize instead, as various platforms have different sizes of window decorations, toolbars, etc.
The current size of the control

SupportedPlatformCommands

IEnumerable<string> SupportedPlatformCommands { get; }
Gets the supported platform commands that can be used to hook up system functions to user defined logic
inherited fromControl.IHandler

TabIndex

int TabIndex { get; set; }
Gets or sets the tab index order for this control within its container.
inherited fromControl.IHandler
Remarks: This sets the order when using the tab key to cycle through controls Note that some platforms (Gtk and WinForms) may not support setting the context of the tab order to StackLayout or DynamicLayout containers and may not behave exactly as expected. Use the PlatformFeatures.TabIndexWithCustomContainers flag to determine if it is supported.
The index of the control in the tab order.

TabStop

bool TabStop { get; set; }
Gets or sets a value indicating whether the user can get to this control using the tab key.
inherited fromControl.IHandler
Remarks: When false, the control is skipped when cycling through controls with the tab key, but can still be focused by clicking on it or by calling Control.Focus(). Note that on Gtk this also prevents the control from being focused by clicking on it, and on iOS and Android this has no effect.
true to include the control in the tab order (the default); false to skip it.

ToolTip

string ToolTip { get; set; }
Gets or sets the tool tip to show when the mouse is hovered over the control
inherited fromControl.IHandler

Visible

bool Visible { get; set; }
Gets or sets a value indicating whether this Control is visible to the user.
inherited fromControl.IHandler
Remarks: When the visibility of a control is set to false, it will still occupy space in the layout, but not be shown. The only exception is for controls like the Splitter, which will hide a pane if the visibility of one of the panels is changed.
true if visible; otherwise, false.

VisualControls

IEnumerable<Control> VisualControls { get; }
Gets an enumeration of controls that are in the visual tree.
inherited fromControl.IHandler
Remarks: This is used to specify which controls are contained by this instance that are part of the visual tree. This should include all controls including non-logical Eto controls used for layout.
The visual controls.

Methods

BeginEdit

void BeginEdit(int row, int column)
Begin to edit one cell
inherited fromGrid.IHandler

CancelEdit

bool CancelEdit()
Cancels the current edit operation and reverts the cell value to the value in the model.
inherited fromGrid.IHandler
true, if edit was canceled or there was no current edit operation, false if the cancel was aborted.

CaptureMouse

bool CaptureMouse()
Captures all mouse events to this control.
inherited fromControl.IHandler
Remarks: This captures all mouse events until Control.IHandler.ReleaseMouseCapture() is called. Note that not all platforms will allow a mouse capture unless the mouse is currently down.
true if the mouse was captured, false otherwise.

CommitEdit

bool CommitEdit()
Commits a current edit operation and sets the current value to the model.
inherited fromGrid.IHandler
true, if edit was commited or there was no current edit operation, false if the commit was cancelled..

DoDragDrop

void DoDragDrop(DataObject data, DragEffects allowedEffects, Image image, PointF cursorOffset)
Starts drag operation using this control as drag source.
inherited fromControl.IHandler
data (DataObject)Drag data.
allowedEffects (DragEffects)Allowed effects.
image (Image)Custom drag image
cursorOffset (PointF)Offset of the cursor to the drag image

Focus

void Focus()
Attempts to set the keyboard input focus to this control, or the first child that accepts focus
inherited fromControl.IHandler

GetCellAt

#
GridCell GetCellAt(PointF location)
Gets the cell information at a specified location from the origin of the control
Remarks: Useful for determining which cell is under the mouse cursor.
location (PointF)Point to find the node
The cell information at the specified location

GetDragInfo

#
Gets the grid drag info for the specified DragEventArgs.
Remarks: Use this to get or set information about where the drop will occur.
args (DragEventArgs)Arguments to get the drag info for.
The drag information.

GetNativeParentWindow

Window GetNativeParentWindow()
Gets a parent window wrapper around the native window
inherited fromControl.IHandler

GetPreferredSize

SizeF GetPreferredSize(SizeF availableSize)
Gets the preferred size of this control given the specified availableSize.
inherited fromControl.IHandler
availableSize (SizeF)The available size to determine the preferred size
The preferred size this control would like to be, which can be larger than the specified availableSize.

HandleEvent

void HandleEvent(string id, bool defaultEvent = false)
Called to handle a specific event
inherited fromWidget.IHandler
Remarks: Most events are late bound by this method. Instead of wiring all events, this will be called with an event string that is defined by the control. This is called automatically when attaching to events, but must be called manually when users of the control only override the event's On... method.
id (string)ID of the event to handle
defaultEvent (bool = false)True if the event is default (e.g. overridden or via an event handler subscription)

Initialize

void Initialize()
Called after the widget is constructed
inherited fromWidget.IHandler
Remarks: This gets called automatically after the control is constructed and the Widget.IHandler.Widget and Widget.Platform properties are set. When the handler has specialized construction methods, then the AutoInitializeAttribute can be used to disable automatic initialization. In this case, it is the responsibility of the subclass to call Widget.Initialize()

Invalidate

void Invalidate(bool invalidateChildren)
Queues a repaint of the entire control on the screen
inherited fromControl.IHandler
Remarks: This is only useful when the control is visible.
invalidateChildren (bool)True to invalidate all children, false to only invalidate the container

Invalidate

void Invalidate(Rectangle rect, bool invalidateChildren)
Queues a repaint of the specified rect of the control
inherited fromControl.IHandler
Remarks: This is only useful when the control is visible.
rect (Rectangle)Rectangle to repaint
invalidateChildren (bool)True to invalidate all children, false to only invalidate the container

MapPlatformCommand

void MapPlatformCommand(string systemCommand, Command command)
Specifies a command to execute for a platform-specific command
inherited fromControl.IHandler
Remarks: Some platforms have specific system-defined commands that can be associated with a control. For example, the Mac platform's cut/copy/paste functionality is defined by the system, and if you want to hook into it, you can use this to map it to your own defined logic. The valid values of the systemCommand parameter are defined by each platform, and a list can be retrieved using Control.SupportedPlatformCommands
systemCommand (string)System command.
command (Command)Command to execute, or null to restore to the default behavior
This example shows how to extend a control with cut/copy/paste for the mac platform:
var drawable = new Drawable();
if (drawable.Generator.IsMac)
{
	drawable.MapPlatformCommand("cut", new MyCutCommand());
	drawable.MapPlatformCommand("copy", new MyCopyCommand());
	drawable.MapPlatformCommand("paste", new MyPasteCommand());
}

PointFromScreen

PointF PointFromScreen(PointF point)
Converts a point from screen space to control space.
inherited fromControl.IHandler

PointToScreen

PointF PointToScreen(PointF point)
Converts a point from control space to screen space
inherited fromControl.IHandler

ReloadData

#
void ReloadData(IEnumerable<int> rows)
Reloads the data at the specified rows.
Remarks: This will refresh the cells of the specified rows with the current data in the model for each row.
rows (IEnumerable<int>)Rows to update.

RemoveGesture

void RemoveGesture(Gesture item)
Removes a gesture from the control.
inherited fromControl.IHandler

ResumeLayout

void ResumeLayout()
Resumes the layout after it has been suspended, and performs a layout
inherited fromControl.IHandler
Remarks: This can be used to optimize some platforms while adding, removing, or changing many child controls at once. Each call to ResumeLayout() must be balanced with a call to Control.IHandler.SuspendLayout() before it.

ScrollToRow

void ScrollToRow(int row)
Scrolls to show the specified row in the view
inherited fromGrid.IHandler

SelectRow

void SelectRow(int row)
Selects the row to the specified row, clearing other selections
inherited fromGrid.IHandler

SetParent

void SetParent(Container oldParent, Container newParent)
Called when the parent of the control has been set
inherited fromControl.IHandler
oldParent (Container)Old parent for the control, or null if the control is added
newParent (Container)New parent for the control, or null if the parent was removed

SuspendLayout

void SuspendLayout()
Suspends the layout of child controls
inherited fromControl.IHandler
Remarks: This can be used to optimize some platforms while adding, removing, or changing many child controls at once. It disables the calculation of control positioning until Control.IHandler.ResumeLayout() is called. Each call to SuspendLayout() must be balanced with a call to Control.IHandler.ResumeLayout().

UnhandleEvent

virtual void UnhandleEvent(string id)
Called when the last subscriber to an event has been removed, so the platform can stop listening for it.
inherited fromWidget.IHandler
Remarks: Only reached for events whose remove accessor uses PropertyStore.RemoveHandlerEvent(string, Delegate), and only for events that were attached because something subscribed to them. An event attached because the widget overrides its On[Event] method is never detached, since it has to keep firing regardless. Most events stay attached for the life of the widget, which costs nothing. Detaching is worth wiring up for the few that hold onto something expensive or process wide while they are attached, such as a system wide hook. Handlers deriving from WidgetHandler<TWidget> get an implementation of this that dispatches to WidgetHandler<TWidget>.DetachEvent(string), which is what to override.
id (string)ID of the event to stop handling

UpdateLayout

void UpdateLayout()
Updates the layout of this control if necessary.
inherited fromControl.IHandler
Remarks: This will ensure the control has had all of its layout applied so you can use its position and size right after this call. Most platforms (except WinForms) use a deferred layout system so that after adding your control to the form dynamically it won't get laid out until the next idle loop. This is useful when you need to know the dimensions of the control immediately.