IViewDefinitions.RegisterGetStyleCallback(string,string,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 editor element definition that can be identified from the specified class.
- 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 is called in the following cases:
- An editor element is displayed
- A field value of the model referenced by the editor element is changed
Note that if the editor element definition cannot be identified from the specified class, nothing is done.
Arguments
Name | Type | Description |
---|---|---|
editorModelClassName | string | Model class name of editor |
elementModelClassName | string | Model class name of editor element |
getter | Func<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 ・・・The model referenced by the editor element to which the tile is applied is passed - target : IStyleProperty ・・・The 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 target style attribute specified - 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 the callback call |
Return value
- void
Exceptions
Name | Exception class | Description |
---|---|---|
Invalid argument | ExtensionArgumentException | If null or an empty string is specified for editorModelClassName If null or an empty string is specified for elementModelClassName |
Duplicate key | ExtensionDuplicationException | If the callback registration key is duplicated |