Class ScriptableProperty
Definition
- Namespace:
- Tizen.NUI
- Assembly:
- Tizen.NUI.dll
- API Level:
- 3
Adds this attribute to any property belonging to a view (control) you want to be scriptable from JSON.
C#Copypublic class ScriptableProperty : Attribute
- Inheritance
-
ScriptableProperty
Remarks
Example:
class MyView : public CustomView { [ScriptableProperty()] public int MyProperty { get { return _myProperty; } set { _myProperty = value; } } }
Internally the following occurs for property registration ( this only occurs once per Type, not per Instance):
- The controls static constructor should call ViewRegistry.Register() (only called once for the lifecycle of the app).
- Within Register() the code will introspect the Controls properties, looking for the ScriptableProperty() attribute.
- For every property with the ScriptableProperty() attribute, TypeRegistration.RegisterProperty is called.
- TypeRegistration.RegisterProperty calls in to DALi C++ Code Dali::CSharpTypeRegistry::RegisterProperty().
- DALi C++ now knows the existance of the property and will try calling SetProperty, if it finds the property in a JSON file (loaded using builder).
The DALi C# example:
class MyView : public CustomView {
[ScriptableProperty()] public double Hours { get { return seconds / 3600; } set { seconds = value * 3600; } } }
Equivalent code in DALi C++: in MyControl.h class MyControl : public Control { struct Property { enum { HOURS = Control::CONTROL_PROPERTY_END_INDEX + 1 } } }
in MyControl-impl.cpp
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::MyControl, Toolkit::Control, Create ); DALI_PROPERTY_REGISTRATION( Toolkit, MyControl, "Hours", INTEGER, DISABLED ) DALI_TYPE_REGISTRATION_END()
Constructors
Declaration
C#Copypublic ScriptableProperty(ScriptableProperty.ScriptableType type = ScriptableProperty.ScriptableType.Default)
Parameters
Type | Name | Description |
---|---|---|
ScriptableProperty.ScriptableType | type |
API Level: 3
Fields
Declaration
C#Copypublic readonly ScriptableProperty.ScriptableType type
Field Value
Type | Description |
---|---|
ScriptableProperty.ScriptableType |
API Level: 3
Properties
Declaration
C#Copypublic ScriptableProperty.ScriptableType Type { get; }
Property Value
Type | Description |
---|---|
ScriptableProperty.ScriptableType |