RadGridView + Office2010Black scroller paint issue

5 posts, 1 answers
  1. Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011

    Posted 03 Oct 2013 Link to this post

    Hello,

    when i am using RadGridView with Office2010Black theme, and loading some data into, i got vertical scrollbar painted wrong. See the screenshot attached.

    My grid initialization section:

    private DataTable dataTable;
     
    public Form1()
    {
        InitializeComponent();
     
        radGridView1.AutoSizeRows = false;
        radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
        radGridView1.RowFormatting += radGridView1_RowFormatting;
        radGridView1.ReadOnly = true;
        radGridView1.ShowRowHeaderColumn = false;
        radGridView1.VerticalScrollState = ScrollState.AlwaysShow;
     
        radGridView1.ThemeName = "Office2010Black";
     
        dataTable = new DataTable();
        dataTable.Columns.Add("number", typeof(int));
        dataTable.Columns.Add("descriptions", typeof(string));
     
        radGridView1.DataSource = dataTable;
     
    }
     
    void radGridView1_RowFormatting(object sender, RowFormattingEventArgs e)
    {
        e.RowElement.RowInfo.Height = 120;
    }

    When loading data, i have (according to requirements) to disable the Grid control first, and enable it as soon as data loaded.
    Here is an example:

    private void radButton1_Click(object sender, EventArgs e)
         {
             radGridView1.Enabled = false;
     
             Random rnd = new Random((int)DateTime.Now.Ticks);
     
             dataTable.Clear();

             for (int i = 0; i < rnd.Next(1000); i++)
             {
                 DataRow row = dataTable.NewRow();
                 row[0] = i + 1;
                 row[1] = "description" + i.ToString();
                 dataTable.Rows.Add(row);
             }
     
             radGridView1.Enabled = true;
         }

    After doing so, i have wrong painting behavior of the vertical scrollbar (it is only so in Office 2010 black theme!!), as it shown on the screenshot. See second image, as it should be expected.

    In addition, i have experinced that the scroller thumb does not update it's height immediately, according to the added rows count.
    It will only redraw itself when user is dragging it or resizing control.

    I have tried: radGridView1.Invalidate(), but it does not help.

    So far workarounds are:
    1) decorating code with BeginUpdate/EndUpdate does partially fix the problem, scrollbar thumb does not change it's size
    2) do not disable grid when loading data - works fine for me and even updates scrollbar thumb size, but i need to disable grid before doing data loading due to application requirements.


  2. Answer
    Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3204 posts

    Posted 08 Oct 2013 Link to this post

    Hello Igor,

    Thank you for contacting Telerik Support.

    I confirm that this is an issue with our RadGridView using Office2010Black theme. I have logged this issue in our Public Issue Tracking System - PITS. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - PITS issue. I have also updated your Telerik points. Although, it is not supposed to add rows in disabled state of the grid, the possible workaround I can propose is to modify button Click event handler as follows:
    private void radButton1_Click(object sender, EventArgs e)
    {
        radGridView1.VerticalScrollState = ScrollState.AlwaysHide;
        radGridView1.Enabled = false;
        radGridView1.BeginEdit();
     
        Random rnd = new Random((int)DateTime.Now.Ticks);
        dataTable.Clear();
        for (int i = 0; i < rnd.Next(1000); i++)
        {
            DataRow row = dataTable.NewRow();
            row[0] = i + 1;
            row[1] = "description" + i.ToString();
            dataTable.Rows.Add(row);
        }
         
        radGridView1.EndEdit();
        radGridView1.Enabled = true;
        radGridView1.VerticalScrollState = ScrollState.AlwaysShow;
        radGridView1.TableElement.VScrollBar.ResetLayout(true);
        radGridView1.MasterTemplate.Refresh();
        radGridView1.TableElement.ScrollToRow(radGridView1.CurrentRow);
    }

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. Igor
    Igor avatar
    145 posts
    Member since:
    Jan 2011

    Posted 08 Oct 2013 Link to this post

    Thank you for your help, Desislava!
  4. Brian
    Brian avatar
    5 posts
    Member since:
    Sep 2007

    Posted 12 Nov 2014 Link to this post

    Hi Desislava,

    I also get the behavior that Igor describes with the vertical scrollbar thumb not properly resizing itself with the Office2010Blue theme.  I am using WinForms v2014.3.1104.40.

    The workaround you suggested to force the scrollbar to reset its layout does solve the problem.

    Thanks,

    Brian
  5. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3204 posts

    Posted 17 Nov 2014 Link to this post

    Hello Brian,

    Thank you for writing.

    I am glad that the suggested solution works for your specific case. Note that the feedback item was completed in Q1 2014. Hence, it is not necessary to use it in the specified version 2014.3.1104.40.

    However, if you are still experiencing any difficulties after removing the workaround, please specify in details how to reproduce the problem on my end. Thus, we would be able to investigate the precise case and assist you further. Thank you in advance.

    I hope this information helps. Should you have further questions, I would be glad to help.

    Regards,
    Desislava
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top