When setting style properties at design time, it is important to understand the distinction between named styles and the anonymous styles exposed by grid properties.
Named styles provide templates that govern the appearance of the grid, its splits, and its columns. At design time, create, modify, and delete named styles using the GridStyleCollection Editor. At run time, the GridStyleCollection is used to represent the same set of named Style objects.
Anonymous styles are not members of the GridStyleCollection. However, anonymous styles are provided so that the appearance of an individual split or column can be easily and directly customized 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, to vertically center cell data within a particular grid column, modify the VerticalAlignment member of the column's Style property in the C1DisplayColumnCollection Editor.
Note that modifying an anonymous style is just like modifying a named style. Expand the desired Style object node in a property tree, and then select and edit one or more of its member properties.
Send comments about this topic to ComponentOne. Copyright © ComponentOne LLC. All rights reserved. |