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 acquisition callback function of the editor element generated from the specified editor element definition.

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

argument

NameTypeDescription
elementDefIElementDefEditor Element Definition
getterFunc <IEditorElement, IModel, IStyleProperty, object>Callback function for getting style value

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

-Arguments
--element: IEditorElement ・ ・ ・ The editor element to which the style is applied is passed
--model: IModel ・ ・ ・ Tile application target The model referenced by the editor element is passed
--target: IStyleProperty ・ ・ ・ Target style attribute information is passed
-Return value
--object ・ ・ ・ Handled as a result of Get Returns an object
--The callback function must be an object that matches the type of the specified target style attribute
--The exception is especially if it returns an object that does not match the type. It is automatically converted to the value of IStyleProperty.CurrentValue
-Handling of exceptions
-If the implementation of the callback function throws an exception, the exception is caught and the callback is called. As a result, the value of IStyleProperty.CurrentValue is used
propertiesStyleAttributesStyle attributes
(If multiple style attribute names are specified, callback registration is performed for each)

Return value

  • void

Exception

NameException ClassDescription
Duplicate keyExtensionDuplicationExceptionIf the callback registration key is duplicated