Alternative Row Background Colors

2 posts, 0 answers
  1. Jason
    Jason avatar
    17 posts
    Member since:
    May 2008

    Posted 25 Jul 2012 Link to this post

    I am using the VisualListItemFormatting event to achieve an alternating item background color effect like so:

    Private _rowIndex As Integer = 0
        Private Sub cmb_VisualListItemFormatting(sender As Object, args As VisualItemFormattingEventArgs) Handles cmb.VisualListItemFormatting
            If _rowIndex Mod 2 = 0 Then
                args.VisualItem.SetValue(LightVisualElement.BackColorProperty, Color.FromArgb(224, 226, 255))
                args.VisualItem.SetValue(LightVisualElement.GradientStyleProperty, GradientStyles.Solid)
            End If
            _rowIndex = _rowIndex + 1
        End Sub

    However, this appears to affect the mouse over background color. Here's the default mouseover on a row not impacted by the formatting above (note the entire background is highlighted):

    And here's the mouseover on a row impacted by the formatting (note that the background is not highlighted - only a border appears):

    How can I make these consistent? Preferably all of the items would have the entire background color changed. OR, is there a better way to achieve alternating item colors that would not cause this issue?
  2. Stefan
    Stefan avatar
    2911 posts

    Posted 30 Jul 2012 Link to this post


    Your question has already been answered in the support thread you've opened. Please, see our answer there for more information.

    We kindly ask you to use just one support channel to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two or more tickets instead of one. Moreover threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.

    Thank you for your understanding. 

    All the best,
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Back to Top