How to change the default arrow icon in RadGridView?

13 posts, 1 answers
  1. Reshu
    Reshu avatar
    3 posts
    Member since:
    Jun 2008

    Posted 24 Jun 2008 Link to this post

    Hi,

    Is it possible to change the deafult arrow icon used to navigate in the hierarchical structure in RadGridView winform control?

    Regards,
    Reshu

  2. Reshu
    Reshu avatar
    3 posts
    Member since:
    Jun 2008

    Posted 24 Jun 2008 Link to this post

    Please let me know it is possible to change the default arrow icon used for navigating the hierarchical structure in the RadGridView. Say I would like a different image in place of arrow, on click of this image the chid rows should be expanded. (For instance + used  in standard  DataGrid control in .NET).

    I am in the process of evaluating the RadGrid for my requirement. It would help if I get a quick response.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 25 Jun 2008 Link to this post

    Hello Reshu,

    Thank you for your interest in our products.

    Currently, setting an image for the arrow of the hierarchy navigation is not supported. However, you can change the arrow to a plus/minus symbol just like in the standard grid. You can observe this in several of our predefined themes: VistaTelerik, VistaOrange, Basic and Telerik.

    In order to set the expand/collapse symbol to be a plus/minus symbol you should use our Visual Style Builder application which helps you create your own custom themes for our controls. Please take a look at the videos section for more information about using VSB. In your particular case, you should:

    1. Load RadGridView control into the Visual Style Builder.
    2. In the Control Structure panel, navigate to the GridGroupExpanderCellElement node. Alternatively, just click on the expand/collapse arrow of the grid and the GridGroupExpanderCellElement will be automatically selected.
    3. Set the SignStyle property to PlusMinus.
    4. Now set the DrawSignFill and DrawSignBorder to true. This will allow you to customize the visual color appearance of the expand/collapse symbol. SignBackColor, SignBackColor2, SignBackColor3, SignBackColor4 and SignBorderColor are the properties you need for this purpose.

    If you need further assistance, feel free to contact me.

    Kind regards,

    Nikolay
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Renu
    Renu avatar
    10 posts
    Member since:
    Nov 2008

    Posted 27 Jan 2009 Link to this post

    Hi Nikolay,

    Do we have any other way to change the default arrow icon used for navigating the hierarchical structure in the RadGridView to "+" sign. We are using 8.2.0.0 version of Telerik.


    Regards,
    Renu
  6. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 02 Feb 2009 Link to this post

    Hi Renu,

    Thank you for writing.

    You can change the arrow to plus/minus symbol in runtime by using ViewCellFormating event. Please review the code-block below:
     
    void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)  
    {  
        if (e.CellElement is GridGroupExpanderCellElement)  
        {  
            ((GridGroupExpanderCellElement)e.CellElement).SignStyle = GridGroupExpanderCellElement.SignStyles.PlusMinus;  
            ((GridGroupExpanderCellElement)e.CellElement).DrawSignFill = true;  
            ((GridGroupExpanderCellElement)e.CellElement).DrawSignBorder = true;  
        }  

    Hope this helps. Do not hesitate to contact me again if you have other questions.

    Best wishes,
    Martin Vasilev
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  7. Andrew
    Andrew avatar
    1 posts
    Member since:
    May 2008

    Posted 20 Jan 2010 Link to this post

    I am using RadGrid and cannot find the event ViewCellFormating you mentioned. Please help.
    Andrew
  8. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 22 Jan 2010 Link to this post

    Hi Andrew,

    Thank you for contacting us. It is possible that you cannot find ViewCellFormatting event if you are using very outdated version of RadControls since it was added upon one of the refacturing. I recommend you download the latest release Q3 2009 SP1 and give it a try. Let me know if you have other questions.

    Kind regards,
    Martin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  9. Clyde
    Clyde avatar
    3 posts
    Member since:
    Apr 2009

    Posted 04 Nov 2010 Link to this post

    We are upgrading from v2009.1 to v2010.2 and the solution in the post above by Martin Vasilev is no longer compiling.

    Neither SignStyle, DrawSignFill, and DrawSignBorder are properties of GridGroupExpanderCellElement anymore.

    What is the alternative in the new version?

  10. Clyde
    Clyde avatar
    3 posts
    Member since:
    Apr 2009

    Posted 04 Nov 2010 Link to this post

    Oh! Found it... Not very cool to cause so many breaking changes! Surely these properties should have been "obseleted" rather than deleted.

    The new property is called Expander on the GridGroupExpanderCellElement which contains all the expander element settings

    // Override some Theme values
    if (e.CellElement is GridGroupExpanderCellElement)
    {
        ((GridGroupExpanderCellElement)e.CellElement).Expander.SignStyle = GridExpanderItem.SignStyles.PlusMinus;
        ((GridGroupExpanderCellElement)e.CellElement).Expander.DrawSignFill = false;
        ((GridGroupExpanderCellElement)e.CellElement).Expander.DrawSignBorder = false;
    }
  11. Martin Vasilev
    Admin
    Martin Vasilev avatar
    1061 posts

    Posted 10 Nov 2010 Link to this post

    Hello Clyde,

    I am glad you have managed to find a suitable solution for your scenario. Let us know if you have any additional questions.

    All the best,
    Martin Vasilev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  12. min
    min avatar
    2 posts
    Member since:
    Feb 2011

    Posted 13 Feb 2011 Link to this post

    I am using RadControls for WinForms Q3 2010. i can change the image of expand(plus) like in above example.

            private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
            {
                if (e.CellElement is GridGroupExpanderCellElement)
                {
                    ((GridGroupExpanderCellElement)e.CellElement).Expander.SignStyle = GridExpanderItem.SignStyles.Image;
                    ((GridGroupExpanderCellElement)e.CellElement).Expander.DrawSignFill = false;
                    ((GridGroupExpanderCellElement)e.CellElement).Expander.DrawSignBorder = false;
                    ((GridGroupExpanderCellElement)e.CellElement).Expander.SignImage  = Image.FromFile(@"Resources\arrowDown.png");
                
                    
                }
            }

    but i want 2 images one for colapsed and other for expanded. how is it possible...
  13. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 14 Feb 2011 Link to this post

    Hello Min,

    Yes, you can change the image. First, you have to give it the two images depending on if it is expanded or not.
    private void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
    {
        if (e.CellElement is GridGroupExpanderCellElement)
        {
            ((GridGroupExpanderCellElement)e.CellElement).Expander.SignStyle = GridExpanderItem.SignStyles.Image;
            ((GridGroupExpanderCellElement)e.CellElement).Expander.DrawSignFill = false;
            ((GridGroupExpanderCellElement)e.CellElement).Expander.DrawSignBorder = false;
            if (((GridGroupExpanderCellElement)e.CellElement).Expanded)
            {
                ((GridGroupExpanderCellElement)e.CellElement).Expander.SignImage = Image.FromFile(@"Resources\arrowDown.png");
            }
            else
            {
                ((GridGroupExpanderCellElement)e.CellElement).Expander.SignImage = Image.FromFile(@"Resources\arrowUp.png");
            }
        }
    }

    and then you have to cause the row to format when the hierarchy expands and collapses
    this.radGridView1.GroupExpanding += new Telerik.WinControls.UI.GroupExpandingEventHandler(this.radGridView1_GroupExpanding);

    private void radGridView1_ChildViewExpanded(object sender, ChildViewExpandedEventArgs e)
    {
        e.ParentRow.InvalidateRow();
    }

    Hope that helps
    Richard
  14. min
    min avatar
    2 posts
    Member since:
    Feb 2011

    Posted 16 Feb 2011 Link to this post

    Thanks Richard,

    Its working now...
Back to Top
UI for WinForms is Visual Studio 2017 Ready