Click or drag to resize

DefaultStyleProviderAddT Method

Adds a style for a widget

Namespace:  Eto
Assembly:  Eto (in Eto.dll) Version: 2.5.3-dev
Syntax
public void Add<T>(
	string style,
	Action<T> handler
)
where T : class

Parameters

style
Type: SystemString
Identifier of the style
handler
Type: SystemActionT
Delegate with your logic to style the widget

Type Parameters

T
Type of the widget or handler to style
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.
Examples
// 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
});
See Also