Official Content

Assigns a Design System Class (or a Theme Class) to a control.

Syntax

control. class = { styleClass:StyleClassName | Value }...

Where:

control
   
Name of the control to which you want to assign one or more classes.

StyleClassName
   
Name of the class that you want to associate with the control, among those of the Style (Design System Object or Theme) associated with the object that contains the control.

Value 
    Represents a string that can be assigned to this property at runtime. It can be either a constant string or a variable.

Scope

Generators: .NET, .NET Framework, Android, Angular, Apple, Java

Runtime/Design time

This property applies both at runtime and at design time.

Samples

In the following example, a Theme Class is assigned to the class property of a “Grid1” grid control.

”GreenGrid” and ”BlueGrid” are two classes derived from the “Grid” predefined class. These classes are defined in the Theme associated with the object that contains the control.

//A ThemeClass is asssigned
If &import > 0
   Grid1.class = StyleClass:GreenGrid
Else
   Grid1.class = StyleClass:BlueGrid
Endif

//A Value is assigned
If &import > 0
   Grid1.class = !”GreenGrid”
Else
   Grid1.class = !”BlueGrid”
EndIf

To associate two or more classes with a control's class property, just use the '+' operator to concatenate the strings, as the following code shows:

If &import > 0
   Grid1.class = StyleClass:GreenGrid + !" " + StyleClass:GreenLightGrid
Else
   Grid1.class = StyleClass:BlueGrid + !" " + StyleClass:BlueLightGrid
Endif

Important: It is highly recommended that you use the StyleClass:ClassName syntax because it creates a reference to the Theme class or Design System class. When a string value is used, there is no way to know which classes are referenced by an object.

See Also

Last update: November 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant