15.9. Working with List Styles
Problem
You want to apply style settings to list components.
Solution
Use the styles specific to the list components, including alternatingRowColors, rollOverColor, selectionColor, selectionEasing, textRollOverColor, textSelectedColor, selectionDisabledColor, selectionDuration, and useRollOver.
Discussion
There are quite a few styles that are specific to list components, primarily because they deal with the colors of the list elements as they are moused over and selected. Most of those properties are color properties:
-
rollOverColor The color of a row when the user moves the mouse over it
-
selectionColor The color of a row when it has been selected
-
textRollOverColor The color of the text in a row when the user moves the mouse over it
-
textSelectedColor The color of the text in a row when it has been selected
-
selectionDisabledColor The color of a row when it is selected and the entire list has been disabled (the enabled property set to
false)
Additionally, you can assign a group of color values such that the background colors of the rows are different from the adjacent rows. For example, if you assign the colors of red and yellow, the row colors will alternate between red and yellow. If you assign the colors of blue, green, and magenta, the row colors will repeat that pattern. In order to accomplish this, assign an array of colors to the alternatingRowColors style property. You can use any valid syntax to create the array. However, often the most convenient ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access