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

Remove the blue square which surrounding the expander

8 Answers 209 Views
GridView
This is a migrated thread and some comments may be shown as answers.
tphan
Top achievements
Rank 1
tphan asked on 16 Feb 2012, 03:26 AM
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 !

8 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 20 Feb 2012, 01:40 PM
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 >>
0
tphan
Top achievements
Rank 1
answered on 20 Feb 2012, 02:06 PM
Hi Stefan..

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

Many Thanks =)




0
tphan
Top achievements
Rank 1
answered on 21 Feb 2012, 11:23 AM
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.



0
Stefan
Telerik team
answered on 23 Feb 2012, 11:49 AM
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 >>
0
tphan
Top achievements
Rank 1
answered on 24 Feb 2012, 07:25 PM
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.
0
Stefan
Telerik team
answered on 29 Feb 2012, 01:01 PM
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 >>
0
tphan
Top achievements
Rank 1
answered on 04 May 2012, 12:22 PM
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.
0
Stefan
Telerik team
answered on 07 May 2012, 03:16 PM
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 >>
Tags
GridView
Asked by
tphan
Top achievements
Rank 1
Answers by
Stefan
Telerik team
tphan
Top achievements
Rank 1
Share this question
or