Skip to main content

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

Namespace: NextDesign.Core

Description

Registers a callback function for retrieving the style value of the editor element generated from the specified editor element definition.

  • It is recommended to call this when activating the extension.
  • Style values are retrieved in the following order of priority.
     1. Callback function value for retrieving style value
     2. Style value set in the view instance
     3. Style value defined in the view definition
  • To change the text color of the title text, redefine the text color in the callback function of this method.
  • The registered callback function will be called when:
     ・Editor element is displayed
     ・Field value of model referenced by editor element is changed

Arguments

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)

- Arguments
- element : IEditorElement ・・・Editor element to which style is applied
- model : IModel ・・・Model referenced by editor element to which tile is applied is passed
- target : IStyleProperty ・・・Target style attribute information is passed
- Return value
- object ・・・ Returns the object to be treated as the result of Get
- The callback function must be an object that matches the type of the specified target style attribute
- If an object that does not match the type is returned, no exception will be raised and it will be automatically converted to the value of IStyleProperty.CurrentValue
- Exception handling
- If an exception is thrown in the implementation of the callback function, the exception will be caught and the value of IStyleProperty.CurrentValue will be used as the result of calling the callback

Return value

  • void

Exception

NameException classDescription
Invalid argumentExtensionArgumentExceptionWhen null is specified for elementDef
Duplicate keyExtensionDuplicationExceptionWhen the callback registration key is duplicated