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

How to change the default arrow icon in RadGridView?

12 Answers 411 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Reshu
Top achievements
Rank 1
Reshu asked on 24 Jun 2008, 06:18 AM
Hi,

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

Regards,
Reshu

12 Answers, 1 is accepted

Sort by
0
Reshu
Top achievements
Rank 1
answered on 24 Jun 2008, 12:39 PM
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.
0
Nikolay
Telerik team
answered on 25 Jun 2008, 11:39 AM

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
0
Renu
Top achievements
Rank 1
answered on 28 Jan 2009, 05:08 AM
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
0
Martin Vasilev
Telerik team
answered on 02 Feb 2009, 09:45 AM
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.
0
Andrew
Top achievements
Rank 1
answered on 20 Jan 2010, 07:00 AM
I am using RadGrid and cannot find the event ViewCellFormating you mentioned. Please help.
Andrew
0
Martin Vasilev
Telerik team
answered on 22 Jan 2010, 03:30 PM
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.
0
Clyde
Top achievements
Rank 1
answered on 05 Nov 2010, 01:57 AM
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?

0
Clyde
Top achievements
Rank 1
answered on 05 Nov 2010, 02:02 AM
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;
}
0
Martin Vasilev
Telerik team
answered on 10 Nov 2010, 03:40 PM
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
0
min
Top achievements
Rank 1
answered on 13 Feb 2011, 08:21 AM
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...
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 14 Feb 2011, 10:49 AM
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
0
min
Top achievements
Rank 1
answered on 17 Feb 2011, 04:06 AM
Thanks Richard,

Its working now...
Tags
GridView
Asked by
Reshu
Top achievements
Rank 1
Answers by
Reshu
Top achievements
Rank 1
Nikolay
Telerik team
Renu
Top achievements
Rank 1
Martin Vasilev
Telerik team
Andrew
Top achievements
Rank 1
Clyde
Top achievements
Rank 1
min
Top achievements
Rank 1
Richard Slade
Top achievements
Rank 2
Share this question
or