[GridGroupExpanderCellElement].Expander.SignSize

3 posts, 1 answers
  1. christian
    christian avatar
    4 posts
    Member since:
    Jun 2015

    Posted 04 Nov 2015 Link to this post

    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. Answer
    Dess
    Admin
    Dess avatar
    1605 posts

    Posted 05 Nov 2015 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. christian
    christian avatar
    4 posts
    Member since:
    Jun 2015

    Posted 05 Nov 2015 in reply to Dess Link to this post

    Thanks Dess ! It works fine.
Back to Top