Class property

Official Content
This documentation is valid for:
Many aspects of the user interface are configured in controls, attributes and variables that can be modified using the Class property. When you set a class, actually you are setting several properties of the control such as font, color, border, transformations and more. GeneXus allows you to change these UI properties both at design time and at runtime just by setting the Class property.

Syntax

control. Class = ThemeClass object or Value

Where:
ThemeClass object 
    Represents the class defined in the theme associated to that control.   

Value 
    Represents the name of a class defined in the theme associated to the object that contains the control. 

The value assigned to this property at runtime can be either a constant value or a variable

Description

Important

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

Samples

In the following example, the class property is assigned to a “Grid1” grid control. The class assigned to the grid is conditioned to the &import value. 

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

//ThemeClass object
If &import > 0
   Grid1.class = ThemeClass:GreenGrid
Else
   Grid1.class = ThemeClass:BlueGrid
Endif
//Value
If &import > 0
   Grid1.class = !”GreenGrid”
Else
   Grid1.class = !”BlueGrid”
EndIf

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

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

Scope

Objects: Panel for Smart Devices, Transaction, Web Panel
Platforms: Web(.Net, Java), Smart Devices(Android, IOS)

See Also

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.