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

radgridview vertical scroll position / location

5 Answers 1176 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chan
Top achievements
Rank 1
Chan asked on 04 Jun 2013, 05:09 AM
Helo !

In a grid(WinForms), by default, vertical scroll appears to the right side of grid and horizontal scroll appears to the bottom of grid.
but I need to display vertical scroll to the left side of grid and horizontal scroll to the top of grid.

For horizontal scroll, please specify some way to display the scroll at top of grid in following position with respect to grid :
a.  just above column headers
b.  just below column header
c.  just above group descriptor(if group descriptor set to true)
d.  in between group descriptor and column headers.
I need to implement any one of these.

For Vertical Scroll : to the left side of grid
a. After RowHeaderColumn (if ShowRowHeaderColumn set to true)
b. Before RowHeaderColumn (if ShowRowHeaderColumn set to true)
c. Simply at the beginning from left(if ShowRowHeaderColumn set to false)


thanks,

Chan

5 Answers, 1 is accepted

Sort by
0
Accepted
Paul
Telerik team
answered on 06 Jun 2013, 04:23 PM
Hello Chan,

Thank you for writing.

In order to change the positions of the scroll bars you have to override the ArrangeOverride method of the GridTableElement. To do that you have to inherit the same and also to inherit the TableViewDefinition.
After that you can reposition the scroll bars as per your convenience as far as the design allows of course.

I have attached a sample project showing how to position them on top and in front respectively.

Hope that helps.

Regards,
Paul
Telerik
RadChart for WinForms is obsolete. Now what?
0
Chan
Top achievements
Rank 1
answered on 08 Jun 2013, 07:48 AM
Helo Paul !

A million thanks to you for this solution. I could never have reached to the code you wrote as solution of my problem.

However, I, achieved by making the following changes to the grid :

1. Setting the Vertical Scroll State of Grid View to Always Hide as, VerticalScrollState = "AlwaysHide"
2. Setting the Minimum, Maximum, Margin properties values of VerticalScrollBar equal to the same property values of radGridView.TableElement.VScrollBar.
private void SetRadVScrollbar()
      {
          //Set Vertical Scrollbar on radGridView1 Grid...
 
           this.radGridView1.VerticalScrollState = ScrollState.AlwaysHide;
             
           radVScrollBar1.Minimum = this.radGridView1.TableElement.VScrollBar.Minimum;
           radVScrollBar1.Maximum = this.radGridView1.TableElement.VScrollBar.Maximum;
           radVScrollBar1.Margin = this.radGridView1.TableElement.VScrollBar.Margin;
      //  radVScrollBar1.Bounds = this.radGridView1.TableElement.VScrollBar.Bounds;
      //  radVScrollBar1.ThumbLength = this.radGridView1.TableElement.VScrollBar.ThumbLength;
 
          
      }

I reverted back my code as you suggested and that worked perfectly. Now, I am feeling comfortable and safe.


Thanks a lot for your support.

Chan
0
Imane
Top achievements
Rank 1
answered on 27 May 2020, 05:40 PM

Hello everyone,

I need your help,

i have an issue in RadGridView using WinForms. when i use the  horizontal scrollbar to see columns in the right side and i select a cell or filter in a column on the right side , the scrollbar move to left.

Thanks in advance

0
Imane
Top achievements
Rank 1
answered on 27 May 2020, 06:26 PM

It's ok i found the solution:

i had to add this code if you have the same problem

int scrollValueH = radgridview1.TableElement.HScrollBar.Value;

radGVPreApprouvee.TableElement.HScrollBar.Value = scrollValueH;

and if you have problem in vertical scroll bar you can use this code:

int scrollValueV = radgridview1.TableElement.VScrollBar.Value;
radGVPreApprouvee.TableElement.VScrollBar.Value = scrollValueV;

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 28 May 2020, 04:35 AM

Hello, Imane,

I am glad that you have found a suitable solution for your scenario.

Indeed, storing the TableElement.HScrollBar.Value or the TableElement.VScrollBar.Value properties are the appropriate way to get the current position of the respective scrollbar and restore to this value after refreshing.

If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
GridView
Asked by
Chan
Top achievements
Rank 1
Answers by
Paul
Telerik team
Chan
Top achievements
Rank 1
Imane
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or