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
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
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
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
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;
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
Our thoughts here at Progress are with those affected by the outbreak.