Skip to main content

IViewDefinitions.RegisterGetStyleCallback(IElementDef,Func<IEditorElement, IModel, IStyleProperty, object>) method

Namespace: NextDesign.Core

Description​

Registers the style value acquisition callback function for the editor element generated from the specified editor element definition.

  • It is recommended to call this when activating the extension.
    ・Style values ​​are obtained in the following order of priority.
  1. Callback function value for style value acquisition
  2. Style values ​​set in the view instance
  3. Style values ​​defined in the view definition
  • If you want to change the font color of the title text, redefine the font color in the callback function of this method.
  • The registered callback function is called as follows.
    ・Editor element is displayed
    ・The field value of the model referenced by the editor element has been changed

argument​

NameTypeDescription
elementDefIElementDefEditor element definition
getterFunc<IEditorElement, IModel, IStyleProperty, object>Callback function for style value acquisition

Callback function specification
object get_styleFunction(IEditorElement element, IModel model, IStyleProperty target)

- Argument
- element: IEditorElement ... The editor element to which the style is applied is passed
- model: IModel ... The tile is to be applied to The model referenced by the editor element is passed
- target: IStyleProperty ...Target style attribute information is passed
- Return value
- object ... As a result of Get Returns the object to work with
- The callback function must be an object that matches the type of the specified target style attribute
- If it returns an object that does not match the type, it will It will be automatically converted to the value of IStyleProperty.CurrentValue
- Handling exceptions
- If the callback function implementation throws an exception, the exception will be caught and The value of IStyleProperty.CurrentValue is used as the call result

Return value​

  • void

Exception​

NameException classDescription
Duplicate keyExtensionDuplicationExceptionIf the callback registration key is duplicated