Search Unity

Help Wanted Changing style for elements using showAlternatingRowBackgrounds

Discussion in 'UI Toolkit' started by niel-archer, Sep 27, 2021.

  1. niel-archer

    niel-archer

    Joined:
    Nov 29, 2016
    Posts:
    17
    I have a ListView using the showAlternatingRowBackgrounds property, but the odd row's style is terrible (bad contrast/colour combination). Is it possible to redefine the style used either through uss or via the code?
     
  2. hugobd

    hugobd

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    123
    Can you try overriding the background color of this uss class: ".unity-collection-view__item--alternative-background"
     
  3. niel-archer

    niel-archer

    Joined:
    Nov 29, 2016
    Posts:
    17
    Yes that did the trick. and .unity-collection-view__item to set the odd lines.

    Many thanks for your help, I never would have found those otherwise.
     
    Last edited: Sep 29, 2021
    hugobd likes this.
unityunity