Remove the blue square which surrounding the expander

9 posts, 0 answers
  1. tphan
    tphan avatar
    22 posts
    Member since:
    Jun 2012

    Posted 15 Feb 2012 Link to this post

    The following code is used to remove the expander [+] or [-] for the Hierarchy Tree.

    Question: Do you know how to remove the blue square which surrounding the expander as well ?

     public void RadGridView_ViewCellFormatting(object sender, CellFormattingEventArgs e)
            {
                if (e.CellElement is GridGroupExpanderCellElement)
                {
                    GridGroupExpanderCellElement cell = e.CellElement as GridGroupExpanderCellElement;
                    if (cell != null && e.CellElement.RowElement is GridDataRowElement)
                    {
                        if (!IsExpandable(cell.RowInfo))
                        {
                            cell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
                        }
                        else
                        {
                            cell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Visible;
                        }
                    }
                }
            }
    Thanks Telerik Team =)
    I have attached a picture to describe the blue square which surrounding the expander, please take a look !
  2. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 20 Feb 2012 Link to this post

    Hi Charles,

    Thank you for writing.

    I assume that you want to change the mentioned cell back color from blue to something else. If this is so, please refer to the following code snippet:
    void radGridView1_ViewCellFormatting(object sender, CellFormattingEventArgs e)
    {
        if (e.CellElement is GridGroupExpanderCellElement)
        {
            GridGroupExpanderCellElement cell = e.CellElement as GridGroupExpanderCellElement;
            if (cell != null && e.CellElement.RowElement is GridDataRowElement)
            {
                if (cell.RowInfo.ChildRows.Count == 0)
                {
                    cell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
                    cell.BackColor = Color.White;
                    cell.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
                }
                else
                {
                    cell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Visible;
                    cell.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
                    cell.ResetValue(LightVisualElement.GradientStyleProperty, Telerik.WinControls.ValueResetFlags.Local);
                }
            }
        }
    }

    Let me know if you have further questions.

    Kind regards,
    Stefan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. tphan
    tphan avatar
    22 posts
    Member since:
    Jun 2012

    Posted 20 Feb 2012 Link to this post

    Hi Stefan..

    I just pasted your code into my program... it remove the blue color box... it looks so great !!!!!!!

    Many Thanks =)




  4. tphan
    tphan avatar
    22 posts
    Member since:
    Jun 2012

    Posted 21 Feb 2012 Link to this post

    Hi Stefan,

    Is that possible remove the expander empty column Instead of changing the color from blue to white ? so that all columns can shift one column to the left... it will be more perfect !

    Thanks!
    Charles.



  5. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 23 Feb 2012 Link to this post

    Hi Charles,

    Thank you for writing back.

    I am not able to provide you with a solution to remove this column without breaking the layout of the row. What I can offer, is to remove the expander cell right border and the left border of the cell in the first column. However, the white space will remain. Attached you can find a sample project.

    I hope that this will work for you.
     
    All the best,
    Stefan
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  6. tphan
    tphan avatar
    22 posts
    Member since:
    Jun 2012

    Posted 24 Feb 2012 Link to this post

    Hi Stefan,

    Yep ! as you say the empty expander cell still exist... I change the color to Red, so that you can easily to spot the emptry expander cell.

    I am pretty appreciate your effort ! I know you have try your best afford.

    Thanks!
    Charles.
  7. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 29 Feb 2012 Link to this post

    Indeed, the cell is still there as I mentioned in my previous post.

    I hope that the proposed solutions will cover your case.
     
    Regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
  8. tphan
    tphan avatar
    22 posts
    Member since:
    Jun 2012

    Posted 04 May 2012 Link to this post

    Hi Stefan,

    You answer is helpful... I have a faced another problem is that when the rows are getting large ! the scrolling is become slow....

    anyway can improve the performace ?

    Thanks.
    Charles.
  9. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 07 May 2012 Link to this post

    Hello Charles,

    Your latest questions does not concern this thread's subject, so I would like to kindly ask you to open a new thread for your latest questions. Here you can find information describing how to use the forums:
    http://www.telerik.com/community/forums/winforms/gridview/important-information-on-using-the-telerik-forums.aspx.

    Looking at the case, I would suggest to open a new support ticket with a sample project attached, so we can investigate it and provide you with adequate support.

    Regards,
    Stefan
    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top