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

[GridGroupExpanderCellElement].Expander.SignSize

2 Answers 149 Views
GridView
This is a migrated thread and some comments may be shown as answers.
christian
Top achievements
Rank 1
christian asked on 04 Nov 2015, 02:55 PM

Hi,

 I try to use a custom image to replace the default arrow icon used to navigate in the hierarchical structure in RadGridView winform control.

No problem to set the image the cellElement does not fit to the image size.
Here's my code :

private void MyGridView_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
       {
           Telerik.WinControls.UI.GridGroupExpanderCellElement cellElement = e.CellElement as Telerik.WinControls.UI.GridGroupExpanderCellElement;
                        
 
           if (cellElement != null)
           {
               
               cellElement.Expander.SignSize = new System.Drawing.Size(30, 30);
               cellElement.Expander.SignImage = Properties.Resources.MyCustomImage;
               cellElement.Expander.SignStyle = Telerik.WinControls.UI.SignStyles.Image;
           }
 
 
       }

       The cellElement.Expander.SignSize seems to have no effect.

 How can I achieve this please ?

 Thanks.

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dess | Tech Support Engineer, Principal
Telerik team
answered on 05 Nov 2015, 12:11 PM
Hello Christian,

Thank you for writing.
 
Note that the size of the expander item is controlled by the column's width and the row's height. If the applied image in the ViewCellFormatting event does not fit the available space, you can adjust the RowHeight and GroupIndent properties  of the TableElement in order to achieve the desired look. Here is an example: 
public Form1()
{
    InitializeComponent();
    this.radGridView1.TableElement.GroupIndent = 50;
    this.radGridView1.TableElement.RowHeight = 40;
}
 
private void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
    Telerik.WinControls.UI.GridGroupExpanderCellElement cellElement =
        e.CellElement as Telerik.WinControls.UI.GridGroupExpanderCellElement;
 
    if (cellElement != null)
    {
        cellElement.Expander.SignImage = Properties.Resources.myimage;
        cellElement.Expander.SignStyle = Telerik.WinControls.UI.SignStyles.Image;
    }
}

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
christian
Top achievements
Rank 1
answered on 05 Nov 2015, 01:27 PM
Thanks Dess ! It works fine.
Tags
GridView
Asked by
christian
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
christian
Top achievements
Rank 1
Share this question
or