radgridview vertical scroll position / location

6 posts, 1 answers
  1. Chan
    Chan avatar
    14 posts
    Member since:
    Nov 2012

    Posted 04 Jun 2013 Link to this post

    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

  2. Answer
    Paul
    Admin
    Paul avatar
    60 posts

    Posted 06 Jun 2013 Link to this post

    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?
  3. Chan
    Chan avatar
    14 posts
    Member since:
    Nov 2012

    Posted 08 Jun 2013 Link to this post

    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
  4. Imane
    Imane avatar
    2 posts
    Member since:
    Feb 2020

    Posted 27 May in reply to Chan Link to this post

    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

  5. Imane
    Imane avatar
    2 posts
    Member since:
    Feb 2020

    Posted 27 May in reply to Imane Link to this post

    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;

     

  6. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3907 posts

    Posted 27 May Link to this post

    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.
Back to Top