ComponentOne List for WinForms
In This Topic
    Named Styles vs. Anonymous Styles
    In This Topic

    When setting style properties at design time, it is important to understand the distinction between named styles and the anonymous styles exposed by list properties.

    Named styles provide templates that govern the appearance of the list, its splits, and its columns. In the designer, you can create, modify, and delete named styles using the Style Collection Editor. In code, the GridStyleCollection is used to represent the same set of named Style objects.

    Anonymous styles are not members of the GridStyleCollection, however. They are provided so that you can easily and directly customize the appearance of an individual split or column without having to define a separate named style.

    The following analogy should help to clarify the distinction between named and anonymous styles. Consider a Microsoft Word document that consists of several paragraphs based on the default normal style. Suppose that one of the paragraphs is a quotation that needs to be indented and displayed in italics. If the document is part of a larger work that contains several quotations, it makes sense to define a special style for that purpose and apply it to all paragraphs that contain quotations. If the document is an early draft or is not likely to be updated, defining a style for one paragraph is overkill, and it would be more convenient to apply indentation and italics to the quotation itself.

    In this analogy, specifying paragraph attributes directly is akin to setting the members of a property that returns an anonymous style. For example, if you want to change the font of a particular list column, you can modify the Font member of the column's Style property in the C1DisplayColumn Collection Editor.

    Note that modifying an anonymous style is just like modifying a named style. You first expand the desired Style object node in a property tree, then select and edit one or more of its member properties.