Search code examples
c#teleriktelerik-reporting

Position report item without hardcode distance from the top


I'm implementing a converter that programmatically builds Telerik reports and populate them with text from the sources of an old proprietary reporting system of a company I'm collaborating with.

I need to define blocks of report items that can be shown/hidden accordingly to an expression that depends on data from the DataSource; my approach is:

  1. define each row of the legacy report as a Telerik Reporting TextBox with CanGrow and CanShrink properties enabled, an Height of 1pica and Docking set to Top;
  2. define a Telerik Reporting Panel for each group of rows that I need to control visibility of; the properties set are the Height (which is set as the Height of all the contained TextBoxes), the Docking (which is set to Top) and the Bindings (which I use to bind "Visibility" to a user-defined expression that returns a boolean);
  3. add the rows to the panel, and the panels to the report section.

I tried both Binding (like said above) and Conditional formatting, but the content of the panels is always not shown (even if I force my user-defined expression to return true or false).

Also, I tried both specifying a position from the top with Top property and not doing it (as I understood from the docs, it should stack the automatically when docking is enabled), but nothing changed: only the components which are not wrapped in a Panel are shown.

What am I doing wrong?


Solution

  • The problem was related to the Width of the row: accordingly to documentation, when using Docking the location and size of the item should be auto-determined based on its container, but if the Width of the panel is not set either, it sicks to 0.

    Setting an arbitrary width (which can be the width of the Report), the row "appears".