Class CustomViewRegistry
Definition
- Assembly:
- Tizen.NUI.dll
View the Registry singleton. Used for registering controls and any scriptable properties they have (see ScriptableProperty).
Internal Design from C# to C++
- Each custom C# view should have it's static constructor called before any JSON file is loaded. Static constructors for a class will only run once ( they are run per control type, not per instance). Example of running a static constructor: System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (typeof(Spin).TypeHandle); Inside the static constructor the control should register it's type with the ViewRegistry For example:
static Spin() { ViewRegistry.Instance.Register(CreateInstance, typeof(Spin) ); }
The control should also provide a CreateInstance function, which gets passed to the ViewRegistry. // Eventually it will be called if DALi Builderfinds a Spin control in a JSON file. static CustomView CreateInstance() { return new Spin(); }
The DALi C++ equivalent of this is
TypeRegistration mType( typeid(Toolkit::Spin), typeid(Toolkit::Control), CreateInstance );
public sealed class CustomViewRegistry
- Inheritance
-
objectCustomViewRegistry
Properties
View SourceInstance
Declaration
public static CustomViewRegistry Instance { get; }
Property Value
Type | Description |
---|---|
CustomViewRegistry |
Methods
View SourceRegister(Func<CustomView>, Type)
The function which registers a view and all it's scriptable properties with DALi's type registry. Means the view can be created or configured from a JSON script.
The function uses introspection to scan a views C# properties, then selects the ones with [ScriptableProperty] attribute to be registered. Example of a Spin view registering itself: static Spin() { ViewRegistry registers control type with DALi type registry also uses introspection to find any properties that need to be registered with type registry ViewRegistry.Instance.Register(CreateInstance, typeof(Spin) ); }
Declaration
public void Register(Func<CustomView> createFunction, Type viewType)
Parameters
Type | Name | Description |
---|---|---|
System.Func<TResult><CustomView> | createFunction | |
Tizen.System.Type | viewType |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown when viewType is null. |