Border in template

4 posts, 0 answers
  1. Simon
    Simon avatar
    9 posts
    Member since:
    Feb 2015

    Posted 13 Feb 2018 Link to this post

    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

  2. Dimitar
    Admin
    Dimitar avatar
    2913 posts

    Posted 14 Feb 2018 Link to this post

    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.
  3. Simon
    Simon avatar
    9 posts
    Member since:
    Feb 2015

    Posted 14 Feb 2018 in reply to Dimitar Link to this post

    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

  4. Dimitar
    Admin
    Dimitar avatar
    2913 posts

    Posted 15 Feb 2018 Link to this post

    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 CellElements 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.
Back to Top