DefaultStyleProvider

References
The default style provider which supports setting styles from delegates.

Properties

Inherit

#
[DefaultValue(true)] public bool Inherit { get; set; }
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.
true to inherit parent styles; otherwise, false.

Methods

Add<T>

#
public void Add<T>(string style, Action<T> handler)
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.
style (string)Identifier of the style
handler (Action<T>)Delegate with your logic to style the widget
// 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
});
Explicit

IStyleProvider.ApplyCascadingStyle

#
void IStyleProvider.ApplyCascadingStyle(object container, object widget, string style)

Events

StyleWidget

#
public event Action<object> StyleWidget
Event to handle when a widget is being styled