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

Stacking/Docking Dynamically Sized Panels Vertically

1 Answer 82 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Rehan
Top achievements
Rank 1
Rehan asked on 11 Feb 2015, 12:18 PM
I have N number of Panel's that I want to stack vertically in my report. Each of those Panel's contains M number of child Panel's, which I also want to stack vertically. Each of these children contains a one or more TextBox/HtmlTextBox/Table's of an unknown size. I need everything to be dynamically sized, I do no know about the size of anything in advance. The report will be exported to PDF format.

A complete code sample is shown below. It creates 3 root level Panel's and each of these contains 2 child Panel's, which contains 2 TextBox's. Why is some of the content missing?

public partial class Report : Telerik.Reporting.Report
{
    public Report()
    {
        InitializeComponent();
 
        for (int i = 0; i < 3; ++i)
        {
            Panel panel = new Panel()
            {
                Docking = DockingStyle.Top,
            };
 
            for (int j = 0; j < 2; ++j)
            {
                panel.Items.Add(GetPanel(j));
            }
 
            this.detail.Items.Add(panel);
        }
 
        this.detail.Items[0].Style.BackgroundColor = Color.LightBlue;
        this.detail.Items[1].Style.BackgroundColor = Color.LightCoral;
        this.detail.Items[2].Style.BackgroundColor = Color.LightCyan;
    }
 
    private Panel GetPanel(int i)
    {
        Panel panel = new Panel()
        {
            Docking = DockingStyle.Top,
        };
 
        TextBox textBox1 = new TextBox()
        {
            Docking = DockingStyle.Left,
            Location = new PointU(Unit.Mm(0D), Unit.Mm(0D)),
            Size = new SizeU(Unit.Mm(50D), Unit.Mm(0D)),
            Value = i + " - Text Box"
        };
        panel.Items.Add(textBox1);
 
        TextBox textBox2 = new TextBox()
        {
            Docking = DockingStyle.Fill,
            Location = new PointU(Unit.Mm(50D), Unit.Mm(0D)),
            Size = new SizeU(Unit.Mm(124D), Unit.Mm(0D)),
            Value = i + " - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur eleifend, dolor ac posuere sollicitudin, nisl nisl hendrerit odio, at pulvinar orci odio vitae ante. Phasellus sapien neque, dignissim nec libero id, iaculis fermentum risus. Aliquam erat volutpat. Praesent mattis lorem vel vulputate fringilla. Donec posuere dui vel nisi egestas, sit amet egestas sapien accumsan. Nullam vehicula ac eros sit amet congue. Integer gravida dolor sit amet justo ultricies, ac euismod nisi auctor. Proin et sem laoreet, sollicitudin ipsum sed, pharetra quam. Sed dapibus, erat in hendrerit tincidunt, dui arcu lacinia mi, maximus ullamcorper purus diam ac nisl. Nunc pulvinar ante vel semper posuere. Ut in pretium sapien. Interdum et malesuada fames ac ante ipsum primis in faucibus. Ut sit amet egestas sem. Duis faucibus libero turpis, sit amet finibus nisl hendrerit nec. "
        };
        panel.Items.Add(textBox2);
 
        return panel;
    }
}

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 13 Feb 2015, 05:07 PM
Hello Rehan,

After serializing the provided report definition in XML, we can validate the created report structure:
  1. Panel items do not have all required settings - Height, Width, Location (these properties are left to default zero). The same applies to TextBox items' Height properties.
  2. Instead of using docking, set only the Panel items size and location. When an item is hidden, if needed, the rest will occupy its space - Design Considerations for Report Item Layout. To shrink the container section or item, you can use the approach from Collapse the container when hiding child report items.


I hope the provided information is helpful.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Rehan
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or