Skip to content

DataGridView Row HotTracking #529

Closed
Closed

Description

@itg-assistant

Cris asked 2017-01-09 20:17:42 UTC

Hi,

I've been looking for a way on how to do hot-tracking a row when the mouse is over a row. I looked at appearance key Table Row in Theme Builder but didn't find any style or properties for Hovered the way Treeview does.

Is it possible?

Thanks.

Activity

  1. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2017-01-09 23:44:35 UTC

    Yes, it's possible but in a slightly different way since rows and cells in a DGV are not widgets, they are rendered directly as html. The nodes in a treeview and items in a listbox are widgets so they have all the standard widget states and behavior. The theme states, styles and properties that a DGV cell recognizes are preset in the cell renderers (you can have customer renderers, but it's a different topic and we'll have an extension with some very cool DGV columns).

    To make it short, you can always use normal CSS in a Wisej theme using the css value under styles. Try this mixin:

    {
     "name": "HotDGV",
       "appearances": {
         "table-row": {
           "inherit": "table-row",
           "states": {
             "default": {
               "styles": {
                 "widthBottom": 1,
                   "colorBottom": "table-row-line",
                   "backgroundColor": "table-row-background",
                   "css": "{\"hover\":{\"cursor\":\"pointer\", \"background-color\":\"red\"}}"
               },
               "properties": {
                 "textColor": "table-row"
               }
            }
          }
        }
      }
    }
    

    You can also use any of the theme colors instead of red. The definition in "css" is translated to pure css by Wisej. Id you specify a child property (in the mixin above it's "hover", Wisej treates is a pseudo style and it prefixes it with ":", so hover becomes ":hover". If you used ":after", it would becomes "::after" and you can add ::after and ::before pseudo elements.

  2. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Cris answered 2017-01-10 16:59:45 UTC

    Hi Luca,

    This is great and works. Just wondering what are

    "widthBottom": 1,
                   "colorBottom": "table-row-line",
                   "backgroundColor": "table-row-background",
    lines for in the under styles. I commented them out and still works. Am I missing something?
    
    Thanks.
    
  3. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Cris answered 2017-01-10 17:21:59 UTC

    Hi Luca,
    I now see the difference when above three lines are commented out. Sorry.

  4. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Luca answered 2017-01-10 17:31:34 UTC

    I copied the values from the theme since I thought that the mixin overrides the entire state. But it looks like it preserves the inherited styles. See

    "inherit": "table-row"
    
  5. itg-assistant commented on Jun 12, 2026

    @itg-assistant
    Author

    Cristian Zerbinati answered 2018-04-20 16:48:31 UTC

    Hi Luca,

    this mixin theme work only for over the last column, but not with the column with text on the cells

    how do for full row?

    thanks

    Cristian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GeneralQuestions, how-tos and everything else.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions