This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided "as is" with no warranties.
It might be requested by users to have the ability to control the styling of text on the form at runtime. Specifically we might want to change the font type and also the font size on the controls. This can be done statically at design time, however in order to get it to happen at runtime for users we can add some additional configuration to get the desired behavior.
Before You Begin
- Establish what styles are currently possible and what is desired by your users.
- Read over the current documentation on conditional styles:
Below is an example of the steps needed for this configuration. Your design and values will most likely be different than what is shown, but the steps below will be adaptable based on what you would like to get at runtime.
1. Create a static drop-down of desired styles. In this example we are configuring for font size and I want a small, default, and large size.
2. Create a relevant condition tied to when the drop-down contains a certain value. Note that this must be done on each control individually. For this example I am building the condition for when the drop-down will contain the value "Small" for when we want our text on this control to be a smaller font size.
3. Set the relevant style you would like on this control based on the drop-down's value. In this case I was configuring the small font size so I chose the smallest size of 6 pt.
Currently the same style must be created in the same fashion on all controls you wish to be able to update at runtime based on that drop-down's value. K2 is looking to make improvements to this functionality in the future such as being able to copy the same conditional styles to other controls.