DefaultStyleProvider
ReferencesThe default style provider which supports setting styles from delegates.
Properties
Inherit
#Gets or sets a value indicating whether this DefaultStyleProvider allows inheriting styles from the parent object.
Remarks: This is used when applying cascading styles, sometimes the user or the provider will not want parent styles to be applicable.
Value:
true to inherit parent styles; otherwise, false.Methods
Add<T>
#Adds a style for a widget
Remarks: Styling a widget allows you to access the widget or its native handler class and apply logic. Styling a handler allows you to access both the platform-specifics for the widget. It requires you to add a reference to one of the Eto.*.dll's so that you can utilize the platform handler directly. Typically this would be called before your application is run.
Parameters:
| style (string) | Identifier of the style |
| handler (Action<T>) | Delegate with your logic to style the widget |
Example:
// make all labels vertically aligned
style.Add<Label>(null, label => {
label.VerticalAlignment = VerticalAlignment.Center;
// other stuff
});
// access native controls to modify things that Eto doesn't give direct access to
style.Add<Eto.Mac.Forms.Controls.ButtonHandler>(null, handler => {
handler.Control.SomeProperty = someValue;
// other stuff
});Implements: ApplyCascadingStyle
Parameters:
| widget (object) |
Implements: ApplyDefault
Implements: ApplyStyle
Events
StyleWidget
#Event to handle when a widget is being styled