[ContentProperty("Items")]
[Handler(ToolBar.IHandler)]
public class ToolBar : Tool, IBindableWidgetContainer
Toolbar widget for use on a Window.
Remarks: Only a single toolbar is currently supported for each window.
See Also: Window.ToolBar
Properties
Bindings
Gets the collection of bindings that are attached to this widget
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.
DataContext
Gets or sets the data context for this widget for binding
Remarks: Subclasses may override the standard behaviour so that hierarchy of widgets can be taken into account. For example, a Control may return the data context of a parent, if it is not set explicitly.
Implements: DataContext
Dock
#Gets or sets the docking hint for the toolbar.
Remarks: Most platforms will not respect this, and is usually only necessary for constrained devices like iOS and Android. Each platform may have a different default docking mode, depending on the type of device. E.g. iPhone will by default show the toolbar on the bottom, whereas iPad and dekstop platforms will show it at the top by default. Additionally, some platforms may choose to show the toolbar in a different way, e.g. the Navigation control on iPhone has a standard toolbar available, so if you are using one it will attempt to use its toolbar to provide the best native experience.
Value: The dock hint.
IsDataContextChanging
Gets a value indicating that the BindableWidget.DataContext property is changing.
Remarks: This can be used to determine when to allow certain logic during the update of the data context. It is used to disable binding setters on the model when the data context changes so that a binding does not cause the view model to be updated when the state hasn't been fully set yet.
Value:
true if the DataContext is currently changing, false otherwise.Implements: IsDataContextChanging
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.
Parent
Gets or sets the parent widget which this widget has been added to, if any
Remarks: When implementing child widgets that can participate in the context based binding (MVVM), You can set this to the parent widget when it is added or removed to it (usually via a collection). Note that you should typically provide a
public new [ParentWidget] Parent { get; } property so that consumers of your API cannot set the parent to an invalid value.Value: The parent widget, or null if there is no parent
Parents
Gets an enumeration of all parent widgets in the heirarchy by traversing the BindableWidget.Parent property.
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;
});TextAlign
#Gets or sets the text alignment hint.
Remarks: Note that some platforms may define the visual style of toolbar items and this just serves as a hint for platforms that support such features (e.g. windows).
Value: The text alignment hint.
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 |
FindParent<T>
Finds a control in the parent hierarchy with the specified type and Widget.ID if specified
Parameters:
| id (string = null) | Identifier of the parent control to find, or null to ignore |
Returns: The parent if found, or null if not found
FindParent
Finds a control in the parent hierarchy with the specified type and Widget.ID if specified
GetCallback
Gets an instance of an object used to perform callbacks to the widget from handler implementations
Remarks: The callback should implement the parent class' Widget.ICallback interface so that there only needs to be a single callback for the entire hierarchy. This should return a static instance to avoid having overhead for each instance of your control.
Returns: The callback instance to use for this widget
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 fromBindableWidget
Remarks: Implementors may override this to fire this event on child widgets in a heirarchy. Alternatively, implement IBindableWidgetContainer for your widget and this will trigger any events on the children automatically. This allows a control to be bound to its own BindableWidget.DataContext, which would be set on one of the parent control(s).
Parameters:
| e (EventArgs) | Event arguments |
OnLoad
#Called when the tool item is loaded to be shown on the form.
Parameters:
| e (EventArgs) | Event arguments. |
Overrides: Tool.OnLoad
OnPreLoad
#Called when the tool item is removed from a form.
Parameters:
| e (EventArgs) | Event arguments. |
Overrides: Tool.OnPreLoad
inherited fromWidget
OnUnLoad
#Called when the tool item is removed from a form.
Parameters:
| e (EventArgs) | Event arguments. |
Overrides: Tool.OnUnLoad
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
Unbind
public virtual void Unbind()
Unbinds any bindings in the BindableWidget.Bindings collection and removes the bindings
Remarks: When you implement IBindableWidgetContainer, this will also unbind any of its children.
UpdateBindings
Updates all bindings in this widget
Remarks: When you implement IBindableWidgetContainer, this will also update bindings for all of its children.
Parameters:
| mode (BindingUpdateMode = BindingUpdateMode.Source) |
Events
inherited fromBindableWidget
Remarks: This may be fired in the event of a parent in the hierarchy setting the data context. For example, the Container widget fires this event when it's event is fired.
Implements: DataContextChanged
inherited fromWidget