FlexGrid MouseOver background

Posted by: doremon1381 on 22 March 2018, 1:39 pm EST

    • Post Options:
    • Link

    Posted 22 March 2018, 1:39 pm EST

    Hi.

    When I want Flexgrid has mouseover background, I following this topic https://www.grapecity.com/en/forums/wpf-edition/how-to-change-the-row-colo_2 to resolve my problem. But when I use Flexgrid with a collection has more than 100 items and I catch event mouseover, it’s very slow. About half of second to see the background of row changes. Do you have any ideal to fix this problem?

    Thank you!

  • Posted 22 March 2018, 7:11 pm EST

    Hello,

    We could observe that this is some lag between the mouse cursor and the mouse with background set. However, after researching we could not find a better way to meet your requirement, hence we are discussing this time {Tracking ID: 315384}

    We will get back to you once we receive any information or find a way to optimize it.

    Regards,

    Ruchir Agarwal

  • Posted 27 March 2018, 11:18 pm EST

    Hi,

    The task of changing the row style is an expensive operation since FlexGrid needs to invalidate visual tree for every operation i.e., It takes time to take effect when we change some style of some element in visual tree.

    To help you on this, we can only suggest to avoid not needed actions and make lag smaller. Please use the below code snippet for the same:```

    private void flex_MouseMove(object sender, MouseEventArgs e)

    {

    C1.WPF.FlexGrid.HitTestInfo ht = this.flex.HitTest(e);

    if (currentRow != ht.Row && (ht.CellType == C1.WPF.FlexGrid.CellType.Cell || ht.CellType == CellType.RowHeader))

    {

    // only apply changes if row index is different from previous one

    if (currentRow != -1)

    {

    flex.Rows[currentRow].Background = null;

    }

         //Get Current Row Index
         currentRow = ht.Row;
    
        //Set Current Row BackColor
        flex.Rows[currentRow].Background = mouseHover;
    }
    

    }

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels