AutoInitializeAttribute Class |
Attribute to specify whether the handler interface should be initialized automatically
Inheritance Hierarchy
Namespace:
Eto
Assembly:
Eto (in Eto.dll) Version: 2.5.3-dev
Syntax [AttributeUsageAttribute(AttributeTargets.Interface)]
public sealed class AutoInitializeAttribute : Attribute
<AttributeUsageAttribute(AttributeTargets.Interface)>
Public NotInheritable Class AutoInitializeAttribute
Inherits Attribute
[<SealedAttribute>]
[<AttributeUsageAttribute(AttributeTargets.Interface)>]
type AutoInitializeAttribute =
class
inherit Attribute
end
The AutoInitializeAttribute type exposes the following members.
Constructors Properties
| Name | Description |
---|
| Initialize |
Gets a value indicating whether to auto initialize the handler, false to defer this to the widget author
|
TopRemarks
Handler interfaces that defer creation of the control to various Create() methods can apply this attribute
so that the initialization can be done afterwards.
If auto initialization is disabled, the widget author must call Widget.Initialize() after the control is created.
Initialization applies styles to the widget and the handler, sets up events based on overridden event methods, etc.
This is only needed by widget authors in advanced scenarios. The default is to auto initialize, so this is
only needed if you want to disable this behaviour.
Examples
An example handler that implements this behaviour:
[AutoInitialize(false)]
public interface IMyWidget : IControl
{
void CreateWithParams(int param1, bool param2);
}
[Handler(typeof(IMyWidget))]
public class MyWidget : Control
{
public MyWidget(int param1, bool param2)
{
((IMyWidget)Handler).CreateWithParams(param1, param2);
Initialize();
}
}
See Also