Style Names - FireMonkey Guide

Back to Styles

There is a difference between form files and style files in the way components are named. Form files use the Name property to name their components. Style files use the StyleName property. Thus in the example in Style Files ‘button1style1’ is the StyleName of the TLayout. Usually the Name property of style elements and other components in a style is not used.

This StyleName property is used in two ways:

  • For top level style elements it is the name of the style which will be searched for by FireMonkey to style a control. See Style Name Lookup
  • For child objects of the style elements it is used to reference individual parts of the style from within the control itself. This use-case will be described in Accessing Style Objects and FindStyleResource.

In the first case your StyleName should be unique among style elements. In the latter case the StyleName should be unique within a given style element but can be safely duplicated in other style elements.

StyleNames are not case sensitive1 and must follow the usual rules for creating Pascal identifiers.

Notes

1: But for some unknown reason the style designer always converts StyleName values to lower case when they are edited.

Categories:

div title=