Cell for Grid controls to create custom content for the cell.
Remarks: The CustomCell is useful when you want to provide a fully custom implementation of a cell, including editable controls. Note that some platforms bahave differently with a CustomCell, depending on the value of SupportsControlView. When
false, the grid will use the Paint event to paint the contents of each cell, and only use CreateCell and ConfigureCell when the cell is in edit mode. When true, the CreateCell and ConfigureCell methods will be used for all cells, even when not in edit mode.Properties
ConfigureCell
#Gets or sets a delegate to configure an cell when it is reused for a different row or the data changes.
Remarks: This should set up your control your cell content to be reused. If null, the DataContext of your control will be set to the row model instance. Typically if you use MVVM data binding, you do not need to override the standard behaviour.
Value: The delegate to configure an existing cell's control for a new row/model instance.
Remarks: This can sometimes be useful to get the platform-specific object. Some handlers may not have any backing object for its functionality, so this may be null. It is more preferred to use the Widget.Handler and cast that to the platform-specific handler class which can give you additional methods and helpers to do common tasks. For example, the Application object's handler for OS X has a AddFullScreenMenuItem property to specify if you want full screen support in your app.
CreateCell
#Gets or sets a delegate to create the contents of the cell.
Remarks: You can also override the OnCreateCell(CellEventArgs) method in subclasses. Note that you need to handle ConfigureCell to set up the cell for a particular row of data as the control may be reused when scrolling the view.
Value: The delegate to create the cell content.
GetIdentifier
#Gets or sets a delegate to get the identifier of the cell based on its content.
Remarks: When you have different controls on a per-row level, each variation must have an identifier string to allow the framework to cache the different types of cells to provide good performance. This hooks into standard cell caching mechanisms in certain platforms, such as on the Mac.
Value: The delegate to get the identifier for the cell.
GetPreferredWidth
#Gets or sets a delegate to get the preferred width of the cell based on its content.
Remarks: This may only be used when SupportsControlView is false.
Value: The delegate to get the preferred width of the cell.
IsDisposed
Gets or sets a value indicating whether this Widget has been disposed.
Remarks: When the widget is disposed, it can no longer be used.
Value:
true if this instance has been disposed; otherwise, false.NativeHandle
public nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
Value: The native handle.
inherited fromWidget
Remarks: This gets set to the current Platform.Instance during the construction of the object
Remarks: Styles allow you to attach custom platform-specific logic to a widget. In your platform-specific assembly, use Add{H} to add the style logic with the same id.
Example:
// in your UI
var control = new Button { Style = "mystyle" };
// in your platform assembly
using Eto.Mac.Forms.Controls;
Styles.AddHandler<ButtonHandler>("mystyle", handler => {
// this is where you can use handler.Control to set properties, handle events, etc.
handler.Control.BezelStyle = NSBezelStyle.SmallSquare;
});SupportsControlView
#Gets a value indicating that the CustomCell on the current platform supports using a Control for its view mode. Gtk and WinForms only support custom controls when editing a cell.
Remarks: When
false, you must handle the Paint event (or override OnPaint(CellPaintEventArgs)) to provide a view mode for the cell contents.Value:
true if supports control view; otherwise, false.Methods
Dispose
public void Dispose()
Disposes of this widget, supressing the finalizer
Parameters:
| disposing (bool) | True if the caller called Widget.Dispose() manually, false if being called from a finalizer |
GetCallback
#Gets an instance of an object used to perform callbacks to the widget from handler implementations
Returns: The callback.
Overrides: Widget.GetCallback
Initialize
protected void Initialize()
Initializes the widget handler
Remarks: This is typically called from the constructor after all of the logic is completed to construct the object. If your handler interface has the AutoInitializeAttribute set to false, then you are responsible for calling this method in your constructor after calling the creation method on your custom handler.
OnConfigureCell
#Configures an existing cell when it is reused for a different row or the data changes.
Remarks: This should set up your control your cell content to be reused. If null, the DataContext of your control will be set to the row model instance. Typically if you use MVVM data binding, you do not need to override the standard behaviour.
Parameters:
| args (CellEventArgs) | Arguments for the cell |
| control (Control) | Existing control to configure for the new cell and/or data |
OnCreateCell
#Creates an instance of the control for a cell.
Remarks: This is called multiple times usually for the number of visible and/or cached cells that are displayed. Note that you need to handle OnConfigureCell(CellEventArgs, Control) to set up the cell for a particular row of data as the control may be reused when scrolling the view. If you intend on creating a different type of cell control based on the item, you should also override GetIdentifier
Parameters:
| args (CellEventArgs) | Arguments when creating the cell to get the row, item and state. |
Returns: The control to display in the cell.
OnGetIdentifier
#Gets the identifier of the cell based on its content.
Remarks: When you have different controls on a per-row level, each variation must have an identifier string to allow the framework to cache the different types of cells to provide good performance. This hooks into standard cell caching mechanisms in certain platforms, such as on the Mac.
Value: The identifier for the cell.
Parameters:
| args (CellEventArgs) | Arguments for the cell |
See Also: GetIdentifier
OnGetPreferredWidth
#Gets the preferred width of the cell based on its content.
Remarks: This may only be used when SupportsControlView is false.
Value: The preferred width of the cell.
Parameters:
| args (CellEventArgs) | Arguments for the cell |
inherited fromWidget
ToString
Gets a string that represents the current object with its ID if specified.
Returns: A string value indicating the type and ID (if specified) of this widget.
Overrides: Object.ToString
Events
inherited fromWidget