C1DataGrid has problem when scroll

Posted by: doremon1381 on 29 May 2018, 6:49 pm EST

    • Post Options:
    • Link

    Posted 29 May 2018, 6:49 pm EST - Updated 4 October 2022, 12:11 am EST

    Hi.

    When I move the cursor on a cell, the row is change background by MouseOverBackground property, then I move the cursor on a cell and scroll. After bottom row is over, only the cell what the cursor is on has brush of MouseOverBackground, orther cells in row return to default style.

    Can you help me to fix this problem?

    Thank you!

  • Posted 30 May 2018, 5:28 pm EST

    Hi,

    Try to implement the Window’s Loaded and C1DataGrid’s LoadedRowPresenter and UnloadedRowPresenter events as below:

            Brush outBrush = Brushes.Transparent;
            Brush inBrush = Brushes.Transparent;
            private void Window_Loaded(object sender, RoutedEventArgs e)
            {
                inBrush = grid.MouseOverBrush.Clone();
                grid.MouseOverBrush = Brushes.Transparent;
            }
            private void grid_LoadedRowPresenter(object sender, C1.WPF.DataGrid.DataGridRowEventArgs e)
            {
                if (e.Row.Presenter != null && (!(e.Row.Presenter is DataGridNewRowPresenter)))
                {
                    e.Row.Presenter.MouseEnter += Presenter_MouseEnter;
                    e.Row.Presenter.MouseLeave += Presenter_MouseLeave;
                }
            }       
            private void Presenter_MouseEnter(object sender, MouseEventArgs e)
            {
                outBrush = (sender as DataGridRowPresenter).Background;
                (sender as DataGridRowPresenter).Background = inBrush;
            }
    
            private void Presenter_MouseLeave(object sender, MouseEventArgs e)
            {
                (sender as DataGridRowPresenter).Background = outBrush;
            }
            private void grid_UnloadedRowPresenter(object sender, C1.WPF.DataGrid.DataGridRowEventArgs e)
            {
                if (e.Row.Presenter != null && (!(e.Row.Presenter is DataGridNewRowPresenter)))
                {
                    e.Row.Presenter.Background = outBrush;
                    e.Row.Presenter.MouseEnter -= Presenter_MouseEnter;
                    e.Row.Presenter.MouseLeave -= Presenter_MouseLeave;
                }
            }
    

    Hope, this will solve your issue.

    Thanks,

    Singh

  • Posted 7 June 2018, 6:36 pm EST

    Thank you!

  • Posted 5 August 2018, 3:30 pm EST

    Hi!

    Thanks for your solution, I try to implement and it works. However I used many events to custom style and when I use LoadedRowPresenter in another control base on C1DataGrid to do something I want, this issue still happen. I’m sorry because I can’t attach the sample here but I wonder why you don’t consider to fix my problem in the next version or release?

    Thank you!

  • Posted 7 August 2018, 4:10 pm EST

    Hi,

    We have forwarded your request to fix this issue, to the concerned team [ID: 337778]. We’ll update you when the build including this fix is released.

    Thanks,

    Ruchir

  • Posted 13 August 2018, 1:26 pm EST

    Thank you!

  • Posted 14 November 2018, 9:09 pm EST

    Hi,

    This issue has been fixed in the latest release build which can be downloaded from the link below:

    http://prerelease.componentone.com/dotnet40/c1wpflibrary/2018-t3/C1WPFBasicLibrary.4_4.0.20183.611.zip

    You can upgrade to this using C1Live.

    ~Pragati

Need extra support?

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

Learn More

Forum Channels