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

Border in template

3 Answers 65 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Simon
Top achievements
Rank 1
Simon asked on 13 Feb 2018, 04:22 PM

Hi,

I'm working with a RadGridView and add a Template on it with :

GridViewRelation relation = new GridViewRelation(gridView.MasterTemplate, template);

Then I'm trying to customize the view of my gridview because I would like delete all borders on my Template.

I'm trying to do that but it's not enough to delete all borders. What I could do more ?

private void gridView_ViewCellFormatting(object sender, CellFormattingEventArgs e)
{
GridDetailViewCellElement childCell = e.CellElement as GridDetailViewCellElement;
GridGroupExpanderCellElement expanderCell = e.CellElement as GridGroupExpanderCellElement;
if (e.CellElement.ViewTemplate.Parent != null)
{
e.CellElement.BorderBoxStyle = BorderBoxStyle.SingleBorder;
e.CellElement.BorderWidth = 0;
e.CellElement.Padding = new Padding(0);
}
else if (childCell != null)
{
childCell.BorderBoxStyle = BorderBoxStyle.SingleBorder;
childCell.BorderWidth = 0;
childCell.Padding = new Padding(0);
 
childCell.PageViewElement.Header.Visibility = ElementVisibility.Collapsed;
childCell.GridViewElement.DrawBorder = false;
childCell.GridViewElement.GroupPanelElement.DrawBorder = false;
RadPageViewStripElement stripElement = childCell.PageViewElement as RadPageViewStripElement;
if (stripElement != null)
{
stripElement.DrawBorder = false;
stripElement.BorderBoxStyle = BorderBoxStyle.SingleBorder;
stripElement.BorderWidth = 0;
foreach (RadPageViewItem item in stripElement.Items)
{
item.MaxSize = new Size(0, 1);
item.Visibility = ElementVisibility.Hidden;
}
}
}

Thanks for your help,

Simon

3 Answers, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 14 Feb 2018, 09:31 AM
Hi Simon,

What you see is the BackColor and the Border of the PageViewStrip's ContentArea. You can set the following properties to remove it as well:
stripElement.ContentArea.DrawBorder = false;
stripElement.BackColor = Color.White;
stripElement.ContentArea.BackColor = Color.White;
stripElement.Padding = new Padding(0);

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Simon
Top achievements
Rank 1
answered on 14 Feb 2018, 12:37 PM

Thanks very much Dimitar it's perfect now.

I have an other question: My GridView with Template has a Column for the ExpanderCell. I would like to know if it's possible to hide all the time this column (in red on my picture) without hide the column of the GroudDecriptor (in green on my picture) ?

Regards,

Simon

0
Dimitar
Telerik team
answered on 15 Feb 2018, 11:35 AM
Hi Simon,

The best you can do for this case is to hide the GridGroupExpanderCellElement when its parent row is a DataRow:
GridGroupExpanderCellElement expanderCell = e.CellElement as GridGroupExpanderCellElement;
if (expanderCell != null   )
{
    if (!(e.CellElement.RowInfo is GridViewGroupRowInfo))
    {
        expanderCell.Visibility = ElementVisibility.Collapsed;
    }
    else
    {
        expanderCell.Visibility = ElementVisibility.Visible;
    }
      
}

By default, all hierarchy columns have the same width and are constructed of the same and they just look different. 

I hope this will be useful.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Simon
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Simon
Top achievements
Rank 1
Share this question
or