AutoInitializeAttribute

AttributeReferences
Attribute to specify whether the handler interface should be initialized automatically
Remarks: 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.
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(); // ensure you call this on any constructor of your widget
	}
}

Constructors

AutoInitializeAttribute

#
public AutoInitializeAttribute(bool initialize)
Initializes a new instance of the AutoInitializeAttribute class.
initialize (bool)If set to true initialize the widget automatically, otherwise false.

Properties

Initialize

#
public bool Initialize { get; }
Gets a value indicating whether to auto initialize the handler, false to defer this to the widget author