This project has moved. For the latest updates, please go here.

Change report columns

Jul 9, 2012 at 1:32 PM


I´m looking at the code, and I´m not able to figure how can I change the report columns. I have found that the current code auto calculates the number of columns based on Repeater Width property and child elements maxWidth, however I´m not able to change child elements maxWidth:

// Find maximum control size
      var maxHeight =  0.0;
      var maxWidth = 0.0;
      foreach (FrameworkElement child in Children)
        if (child.DesiredSize.Height > maxHeight)
          maxHeight = child.DesiredSize.Height;
        if (child.DesiredSize.Width > maxWidth)
          maxWidth = child.DesiredSize.Width;

      // Is there room left?
      var columns = (int) Math.Truncate(Width/maxWidth);
      var rows = (int) Math.Truncate(Height/maxHeight);
How can I achive this?

Jul 23, 2012 at 11:45 AM

Hi iceclow,

You found the code. I think I will do some refactoring - and use LINQ. But I'm not sure what you are trying to achieve. I used an excellent project from Paul Stovell:

However this project did not support multiple columns. So I had to make some changes, when i implemented the multiple columns. If you describe what you are trying to achieve, then I might be able to help you...


Jul 23, 2012 at 8:37 PM

What I'm trying to achieve is generating a report with only two
columns, instead of using all the columns available, and changing the
cards horizontal size so it fills the column width.

In a later point, I would want to make it available as an option from
the interface, slowing my team to specify the desired columns number.

Also I'm investigating how I can enable Double sided printing, to
print some information in the backside of the card.

Thank you,

Jul 24, 2012 at 11:47 AM

The current implementation of the Repater class is build upon a WrapPanel. So it's not possible to specify the 50% size of parent. With the current implementation - and if you always want to have two columns - I think you have to find the width that produces the two columns that you want, and the Width property for the Border control for all your work-item types to that value. That will work.

BTW: I just refactored the Repeater class to be more efficient and much more readable. Here's the new class:

  public class Repeater : WrapPanel
    public bool TryAdd(FrameworkElement control)
      control.Measure(new Size(Width, Height));

      var sizeAfterControlHasBeenAdded = MeasureOverride(new Size(Width, Height));

      // If the new size is larger than the WrapPanel remove the control and return false
      if (sizeAfterControlHasBeenAdded.Width > Width || sizeAfterControlHasBeenAdded.Height > Height)
        return false;
      return true;