Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
615
How to apply BackGradientStyle, BackHatchStyle for Particular row in UltraGrid?
posted

Imports Infragistics.Win.UltraWinGrid
Imports Infragistics.Win

 Dim row As Integer = grdLocations.ActiveCell.Row.Index

                              Dim appearance As Appearance

                                appearance = New Infragistics.Win.Appearance()
                                appearance.BackGradientStyle = GradientStyle.Elliptical
                                appearance.BackHatchStyle = BackHatchStyle.Wave
                               Me.grdLocations.DisplayLayout.Rows(row).Appearance = appearance

Even If write the above code , The row Appears as Normal....

I want the Selected Row to appear StrikeThrough, or Something Different to Differentiate from Other Rows.

Regards,

Janani.S

 

  • 469350
    Verified Answer
    Offline posted

    Hi Janani,

    The code you have here will apply to the current active row, but since you are setting the appearance on that specific row, it will maintain the same appearance when you leave the row, and if you do it this way, you will have to handle it every time the active row changes.

    If you want to highlight the active (current) row in the grid, then the best way to do it is to use the ActiveRowAppearance property.

    The code you have here doesn't work because you are not specifying any colors. So your gradient and/or hatch is using the same color. A gradient from White to White is just a solid white background.

    Here's how I would do it:


        Private Sub UltraGrid1_InitializeLayout(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout
            Dim layout As UltraGridLayout = e.Layout
            Dim ov As UltraGridOverride = layout.Override

            Dim appearance As Appearance = layout.Appearances.Add("ActiveRow")
            appearance.BackColor = Color.Blue
            appearance.BackColor2 = Color.Chartreuse
            appearance.BackGradientStyle = GradientStyle.Vertical
            ov.ActiveRowAppearance = appearance
        End Sub

    BTW, you can have a hatch or a gradient, but you cannot use both at the same time. If you specify both, only the gradient will apply.