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
550
Keeping the active row visible while swapping between Cardview and normal view
posted

Hello,

I'd like to change between the cardview and the normal view of the grid. The cardview is set to "band.CardSettings.MaxCardAreaCols = 1;", only one card is shown in the cardview mode. Unfortunately, it is not the selected row in the normal view, but always the first row of the grid.

Is it possible to get the following behaviour? Stick out tongue

  • Show always the card of the row, which is selected (activated, higlighted) in the normal view
  • After navigating in the cardview (e.g. 4 cards forward) show this new position in the grid after coming back into the normal view

Thanks!

  • 390
    Offline posted

    You will want to use the AfterCardsScroll event of the Ultragrid - Here is sample code

        Private Sub UltraGrid1_AfterCardsScroll(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.AfterCardsScrollEventArgs) _
                 Handles UltraGrid1.AfterCardsScroll
            ' Turn off any previously Selected ActiveRow
            If Me.UltraGrid1.ActiveRow.Selected = True Then Me.UltraGrid1.ActiveRow.Selected = False
            ' Set the active row to the FirstVisibleCarRow (this works because you only have 1 card in View)
            Me.UltraGrid1.ActiveRow = e.Rows.FirstVisibleCardRow
            ' Now Select the Active Row
            Me.UltraGrid1.ActiveRow.Selected = True
        End Sub

    However, this really only address part of what you want to do, if your grid rows
    require more than one screen, the selected row may not be on the current screen view
    But there is a solution, for that I refer you to:

    Knowledge Base Article: KB01926
    HOWTO:UltraWinGrid Scrolling Parent Row to Top of Grid