RadGrid Scrollbar Theme

4 posts, 1 answers
  1. Ben
    Ben avatar
    11 posts
    Member since:
    Dec 2015

    Posted 28 Apr Link to this post

    Hello,

    I have created a custom theme for our application. I have themed the RadGridView and the RadScrollbars. The issue I have is the scrollbars on the grid.do not respect the theme that was created for the scrollbars. The scrollbar theme does not have dark borders around all of the objects, they are light gray. Yet the grid does not have the light borders. Is these something I am missing?

    There is a screen shot attached.

    Thanks,

    Ben

  2. Answer
    Hristo Merdjanov
    Admin
    Hristo Merdjanov avatar
    712 posts

    Posted 29 Apr Link to this post

    Hello Ben,

    Thank you for writing back.

    It appears that you have a setting in your theme for displaying the borders. You can access the BorderPrimitive objects of the RadScrollbar element in the VSB tool and set their ShouldPaint property to false. I am sending you attached a screenshot for hiding the border of the thumb.

    If you would like you can also perform these modifications at run-time, please check my code snippet below: 
    public Form1()
    {
        InitializeComponent();
     
        this.RemoveScrollbarBorders(this.radGridView1.TableElement.VScrollBar);
        this.RemoveScrollbarBorders(this.radGridView1.TableElement.HScrollBar);
    }
     
    private void RemoveScrollbarBorders(RadScrollBarElement radScrollBarElement)
    {
        radScrollBarElement.BorderElement.ShouldPaint = false;
        radScrollBarElement.ThumbElement.ThumbBorder.ShouldPaint = false;
        radScrollBarElement.FirstButton.ButtonBorder.ShouldPaint = false;
        radScrollBarElement.SecondButton.ButtonBorder.ShouldPaint = false;
    }

    I hope this helps. Please let me know if you need further assistance.

    Regards,
    Hristo Merdjanov
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
     
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ben
    Ben avatar
    11 posts
    Member since:
    Dec 2015

    Posted 29 Apr in reply to Hristo Merdjanov Link to this post

    Hristo,

    I needed to change the scrollbar border colors, not remove them. You code snippet did still help point me in the correct direction.

    Below is the code I came up with if anyone else wants it.

    Thank You,

    Ben

     

    public void SetCoreGridScrollbars()
            {
                // You have to do the grid scrollbar colors in manually since it does not follow the theme
                // set the color once once
                var scrollBorderColor = Color.FromArgb(168,168,168);
                //Vertical
                this.TableElement.VScrollBar.ThumbElement.ThumbBorder.ForeColor = scrollBorderColor;
                this.TableElement.VScrollBar.FirstButton.ButtonBorder.ForeColor = scrollBorderColor;
                this.TableElement.VScrollBar.FirstButton.ArrowPrimitive.ForeColor = scrollBorderColor;
                this.TableElement.VScrollBar.SecondButton.ButtonBorder.ForeColor = scrollBorderColor;
                this.TableElement.VScrollBar.SecondButton.ArrowPrimitive.ForeColor = scrollBorderColor;
                //Horizontal
                this.TableElement.HScrollBar.ThumbElement.ThumbBorder.ForeColor = scrollBorderColor;
                this.TableElement.HScrollBar.FirstButton.ButtonBorder.ForeColor = scrollBorderColor;
                this.TableElement.HScrollBar.FirstButton.ArrowPrimitive.ForeColor = scrollBorderColor;
                this.TableElement.HScrollBar.SecondButton.ButtonBorder.ForeColor = scrollBorderColor;
                this.TableElement.HScrollBar.SecondButton.ArrowPrimitive.ForeColor = scrollBorderColor;
            }

  5. Dimitar
    Admin
    Dimitar avatar
    1414 posts

    Posted 02 May Link to this post

    Hi Ben,

    Thank you for sharing your solution with the community. If you have any other questions, please do not hesitate to contact us.

    Regards,
    Dimitar
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top