IViewDefinitions.RegisterGetCompartmentItemTextStyleCallback(IElementDef,string,Func<INode, int, string, IModel, IStyleProperty, object>,StyleAttributes) method
Namespace: NextDesign.Core
Description
Registers a style value retrieval function for the specified compartment item of the editor element generated from the specified editor element definition by specifying the style attribute.
- It is recommended to call this when activating the extension.
・Style values are obtained in the following order of priority.
- Callback function value for style value acquisition
- Style values set in the view instance
- Style values defined in the view definition
- The registered callback function is called as follows.
・Compartment items are displayed
・The field value of the model referenced by the compartment item has been changed
argument
Name | Type | Description |
---|---|---|
elementDef | IElementDef | Editor element definition |
areaPath | string | Compartment partition path |
getter | Func<INode, int, string, IModel, IStyleProperty, object> | Callback function for style value acquisition Callback function specification object object get_ItemTextStyleFunction (INode node, int areaIndex, string areaPath, IModel itemModel, IStyleProperty target) - Arguments - node: INode ...The shape that owns the compartment item to which the style is applied is passed. - areaIndex : int ...The area index to which the compartment item to which the style is applied belongs is passed. - areaPath : string ...It is set to the partition definition to which the compartment item to which the style is applied belongs. The path string (field name) that is specified is passed - itemModel: IModel ...The model referenced by the compartment item to which the style is applied is passed - target: IStyleProperty ...Target Style attribute information is passed - Return value - object ... Returns an object to treat as the result of Get - Callback function returns the type of the specified target style attribute. It must be a matching object - 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 - If the callback function implementation throws an exception, it will be caught and the value of IStyleProperty.CurrentValue will be used as the result of invoking the callback |
properties | StyleAttributes | Style attributes (If multiple style attribute names are specified, callbacks are registered for each) |
Return value
- void
Exception
Name | Exception class | Description |
---|---|---|
Duplicate key | ExtensionDuplicationException | If the callback registration key is duplicated |