Skip to main content

IViewDefinitions.RegisterGetTextStyleCallback(IElementDef,TextTypes,Func<IShape, TextTypes, string, IModel, IStyleProperty, object>) method

Namespace: NextDesign.Core

Description

Registers a callback function to get the style value of the specified text of 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 RegisterGetStyleCallback callback function.
  • 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
typeTextTypesTextTypes
getterFunc<IShape, TextTypes, string, IModel, IStyleProperty, object>Callback function for getting style values

Callback function specification
object get_TextStyleFunction( IShape shape, TextTypes type, string textPath, IModel model, IStyleProperty target)

- Arguments
- shape: IShape ...The shape that owns the label/text to which the style is applied is passed.
- type : TextTypes ... The target text type (enumeration) is passed.
- textPath : string ... The path string (field name) mapped in the text view definition is passed. It will be passed
- model : IModel ...The model referenced by the editor element to which the tile is applied will be passed
- target : IStyleProperty ...Target style attribute information will be passed
- Return value
- object ... Returns the object to be treated as the result of Get
- The callback function must be an object matching the type of the specified target style attribute
br/> - If you return an object that does not match the type, it will not be an exception and will be automatically converted to the value of IStyleProperty.CurrentValue
- Handling of exceptions
- Implementation of callback function throws an exception, it is caught and the value of IStyleProperty.CurrentValue is used as the result of invoking the callback

Return value

  • void

Exception

NameException classDescription
Duplicate keyExtensionDuplicationExceptionIf the callback registration key is duplicated

Annotation

If 11 or more labels are defined, the style value acquisition callback function cannot be applied to the 11th and subsequent labels.