Skip to main content

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

Namespace: NextDesign.Core

Description

Specify the style attribute and register the style value retrieval callback function for the editor element generated from the specified editor element definition.

  • It is recommended to call it 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 is called in the following cases:
     ・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
- Handling exceptions
- 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
propertiesStyleAttributesStyle attributes
(If multiple style attribute names are specified, a callback will be registered for each one)

Return value

  • void

Exception

NameException classDescription
Invalid argumentExtensionArgumentExceptionnull in elementDef If specified
Duplicate keyExtensionDuplicationExceptionIf the callback registration key is duplicated