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

How can I change size of GridDetailViewRowElement/GridDetailViewCellElement?

13 Answers 195 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 30 Dec 2010, 10:42 AM

Hi!

 

How can I change size of GridDetailViewRowElement/GridDetailViewCellElement?

Default size is too thick for me.

 

Regards

13 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 30 Dec 2010, 11:28 AM
Hello Raymond,

Hope you're well today. Again, this should be a case of using ViewCellFormatting and ViewRowFormatting events. for exmaple
Private Sub RadGridView1_ViewCellFormatting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.CellFormattingEventArgs) Handles RadGridView1.ViewCellFormatting
    If TypeOf e.CellElement Is GridDetailViewCellElement Then
    End If
End Sub

Hope that helps, but let me know if you need more information
Richard
0
Raymond
Top achievements
Rank 1
answered on 30 Dec 2010, 11:34 AM

Thanks, I am ok J

I did exactly what you did and I tried to change couple properties:

              e.CellElement.Size = new Size(2, 2);

              e.CellElement.HorizontalLineWidth = 2;

 

but this element of gird still have the same size (too thick).

 

Regards

 

0
Richard Slade
Top achievements
Rank 2
answered on 30 Dec 2010, 11:36 AM
Hi Ratmond,

Are you able to post a screenshot somewhere of how you would like it to look, and I will do my best to work it out for you.
thanks
Richard
0
Raymond
Top achievements
Rank 1
answered on 30 Dec 2010, 11:43 AM
sure I can send scrennshots
where I can send it?
0
Richard Slade
Top achievements
Rank 2
answered on 30 Dec 2010, 11:44 AM
At the moment, the facility to add screenshots on the telerik site is down. Do you have just some webspace that you can put it on and add the link in this thread?
Thanks
Richard
0
Raymond
Top achievements
Rank 1
answered on 30 Dec 2010, 12:08 PM

I will send link to screenshots when I will come to house (I don`t remember password to my account) – in couple hours.

0
Accepted
Stefan
Telerik team
answered on 03 Jan 2011, 05:07 PM
Hi guys,

You can change the size of the details cell by setting its Padding property when handling the ViewCellFormatting event:

void radGridView1_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
    if (e.CellElement is GridDetailViewCellElement)
    {
        e.CellElement.Padding = new Padding(5);
    }
}

As to the attachments to forum threads, it should be OK now.

Let me know if you need anything else.

Kind regards,
Stefan
the Telerik team
Q3’10 SP1 of RadControls for WinForms is available for download; also available is the Q1'11 Roadmap for Telerik Windows Forms controls.
0
Raymond
Top achievements
Rank 1
answered on 04 Jan 2011, 10:31 AM
works perfect

thanks
0
Martin
Top achievements
Rank 1
answered on 15 Dec 2011, 03:37 PM

Hi all,

the performance is extremly bad if I use the ViewCellFormating event to change the style of the GridDetailViewCellElement. Are there any other way?

Thanks
Martin

0
Stefan
Telerik team
answered on 19 Dec 2011, 04:03 PM
Hello Martin,

Thank you for writing.

I am going to need some more information regarding the scenario causing the observed performance impact. Simply setting the Padding in the ViewCellFormatting event handler should not cause performance impact. However, if you are performing some other time taking operations there, the performance can be reduced, since the event is fired frequently.

Could you please share with me how to replicate this scenario on my end? Or maybe if possible, please open a new support ticket and attach a sample application. We will investigate this case and we will get back to you with the results.

Thank you for your time and cooperation.
 
Kind regards,
Stefan
the Telerik team

Q3’11
of RadControls for WinForms is available for download (see what's new). Get it today.
0
Martin
Top achievements
Rank 1
answered on 20 Dec 2011, 08:51 AM
Hi Stefan,

thanks for your answer. I have a master table with 250 rows and enabled grouping (3 columns). Here I want to change the look of the template table to get a better hierarchy style and want to set another expander picture to get a harmony between the grouping and the template pricture. Further I want to hide the template picture if the template table do not have any rows.
private void dg_Beats_ViewCellFormatting(object sender, Telerik.WinControls.UI.CellFormattingEventArgs e)
{
    Telerik.WinControls.UI.GridGroupExpanderCellElement cell = e.CellElement as Telerik.WinControls.UI.GridGroupExpanderCellElement;
     
    if (e.CellElement is Telerik.WinControls.UI.GridDetailViewCellElement)
    {
        Telerik.WinControls.UI.GridDetailViewCellElement temp = e.CellElement as Telerik.WinControls.UI.GridDetailViewCellElement;
        if (temp.BorderColor != System.Drawing.Color.FromArgb(0xD4, 0xE6, 0xFC))
        {
            temp.Padding = new Padding(40, 0, 0, 5);
            temp.BorderBoxStyle = Telerik.WinControls.BorderBoxStyle.SingleBorder;
            temp.BorderColor = System.Drawing.Color.FromArgb(0xD4, 0xE6, 0xFC);
            temp.BackColor = System.Drawing.Color.FromArgb(0xD4, 0xE6, 0xFC);
            temp.BackColor2 = System.Drawing.Color.FromArgb(0xD4, 0xE6, 0xFC);
            temp.BackColor3 = System.Drawing.Color.White;
            temp.BackColor4 = System.Drawing.Color.White;
        }
    }
     
    if (cell != null && e.CellElement.RowElement is Telerik.WinControls.UI.GridDataRowElement)
    {
        if (cell.RowInfo.ChildRows != null && cell.RowInfo.ChildRows.Count > 0)
        {
            if (cell.RowInfo.IsExpanded == true)
                cell.Expander.SignImage = global::Gina.Properties.Resources.GroupCollapse;
            else
                cell.Expander.SignImage = global::Gina.Properties.Resources.GroupExpand;
            cell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Visible;
        }
        else
            cell.Expander.Visibility = Telerik.WinControls.ElementVisibility.Hidden;
    }
}

If I use the expand all function and start scrolling in the list, the performance is not very well.

Thanks
Martin
0
Stefan
Telerik team
answered on 23 Dec 2011, 09:30 AM
Hi Martin,

Thank you for the further explanation and the sample code.

I have created a sample application according to your description, and in it I have used your code to test the performance. However, performance was not hurt on my end. Please refer to the attached application and give it a try. If you continue experiencing this issue, I would like to kindly ask you to open a new support ticket, and there attach your application, together with detailed description regarding how to reproduce the undesired behavior. We will investigate your application and the we will be able to provide you with further support.

Greetings,
Stefan
the Telerik team

Q3’11
of RadControls for WinForms is available for download (see what's new). Get it today.
0
Ebrahim
Top achievements
Rank 1
answered on 27 Dec 2011, 02:22 PM
Hi Martin,

This will solve your problem.

private void radGridView_ChildViewExpanding(object sender, ChildViewExpandingEventArgs e)
{
  e.Cancel = !IsExpandable(e.ParentRow);
}
 
 
private bool IsExpandable(GridViewRowInfo rowInfo)
{
  GridViewHierarchyRowInfo hRowInfo = rowInfo as GridViewHierarchyRowInfo;
  if (hRowInfo == null) return false;
 
  if (hRowInfo.ChildRow != null && hRowInfo.ChildRow.ChildViewInfos.Count > 0)
  {
    return hRowInfo.ChildRow.ChildViewInfos.Any(info => info.ChildRows.Count > 0);
  }
 
  return false;
}

I got this code from one of the telerik admin.
Try it.
Tags
GridView
Asked by
Raymond
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Raymond
Top achievements
Rank 1
Stefan
Telerik team
Martin
Top achievements
Rank 1
Ebrahim
Top achievements
Rank 1
Share this question
or