PropertyCell
CustomCellCellWidgetA custom cell implementation that implements a generic method of showing different types of controls on a per row basis.
Remarks: This is ideal for things like showing a property grid to edit various properties of an object. The way this works is by using the TypeBinding of each row to determine which PropertyCellType to use from the Types collection. It calls PropertyCellType.CanDisplay(object) on each to find a type that can display based on the value returned. Each PropertyCellType added to the cell must have a unique value for PropertyCellType.Identifier to ensure the correct control is shown in the cell. The identifier is used to cache the content controls generated by the PropertyCellType when displaying the same value for other rows while scrolling. Ideally, the content control generated from the PropertyCellType should use MVVM BindDataContext() methods for its children so that they are updated automatically when reused for different controls. This is not a requirement, however you must then implement/override the PropertyCellType.OnConfigure(CellEventArgs, Control) to update your control when the item/row is changed.
Constructors
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 CustomCell.OnCreateCell(CellEventArgs) method in subclasses. Note that you need to handle CustomCell.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 CustomCell.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;
});Types
#Gets the list of types to use for each cell, in order of preference.
Remarks: When attempting to use a type for a cell, the types collection is scanned in order for the first PropertyCellType that returns true for PropertyCellType.CanDisplay(object).
Value: The list of types this property cell supports.
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.
inherited fromCustomCell
Parameters:
| e (CellEventArgs) | Cell event arguments |
inherited fromCustomCell
Parameters:
| e (CellEventArgs) | Cell event arguments |
inherited fromCustomCell
Parameters:
| e (CellEventArgs) | Cell event arguments |
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 |
Overrides: CustomCell.OnConfigureCell
OnCreateCell
#Creates an instance of the control for a cell.
Parameters:
| args (CellEventArgs) | Arguments when creating the cell to get the row, item and state. |
Returns: The control to display in the cell.
Overrides: CustomCell.OnCreateCell
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 |
Overrides: CustomCell.OnGetIdentifier
OnGetPreferredWidth
Gets the preferred width of the cell based on its content.
Remarks: This may only be used when CustomCell.SupportsControlView is false.
Value: The preferred width of the cell.
Parameters:
| args (CellEventArgs) | Arguments for the cell |
OnPaint
#Raises the PropertyCellType.OnPaint(CellPaintEventArgs) event.
Parameters:
| args (CellPaintEventArgs) | Cell paint arguments. |
Overrides: CustomCell.OnPaint
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
BeginEdit
Event to handle when the cell should begin editing.
CancelEdit
Event to handle when the cell should cancel editing.
CommitEdit
Event to handle when the cell should commit editing.
inherited fromCustomCell
inherited fromWidget