This is a migrated thread and some comments may be shown as answers.

RadGridView + Office2010Black scroller paint issue

4 Answers 100 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Igor
Top achievements
Rank 2
Igor asked on 03 Oct 2013, 11:51 AM
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.


4 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 08 Oct 2013, 11:04 AM
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 >>
0
Igor
Top achievements
Rank 2
answered on 09 Oct 2013, 03:31 AM
Thank you for your help, Desislava!
0
Brian
Top achievements
Rank 1
answered on 12 Nov 2014, 08:18 PM
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
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 17 Nov 2014, 12:35 PM
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.

 
Tags
GridView
Asked by
Igor
Top achievements
Rank 2
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Igor
Top achievements
Rank 2
Brian
Top achievements
Rank 1
Share this question
or