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
Public Sub Add(Of T As Class) (
style As String,
handler As Action(Of T)
)
member Add :
style : string *
handler : Action<'T> -> unit when 'T : not struct
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
style.Add<Label>(null, label => {
label.VerticalAlignment = VerticalAlignment.Center;
});
style.Add<Eto.Mac.Forms.Controls.ButtonHandler>(null, handler => {
handler.Control.SomeProperty = someValue;
});
See Also