WPF GridView: "Newspaper" Column?

wpf, wpf-controls

Solution

This is actually trivial using a `WrapPanel`.

For a hard-coded list:

<WrapPanel Orientation="Vertical">
  <ItemOne />
  <ItemTwo />
  ...
</WrapPanel>

For a data-bound list:

<ItemsControl ItemsSource="...">
  <ItemsControl.ItemsPanel>
    <ItemsPanelTemplate>
      <WrapPanel Orientation="Vertical" />
    </ItemsPanelTemplate>
  </ItemsControl.ItemsPanel>
  <ItemsControl.ItemTemplate>
    <DataTemplate DataType="...">
      ...
    </DataTemplate>
  </ItemsControl.ItemTemplate>
</ItemsControl>

If desired you can replace the `ItemsControl` with a `ListBox` or make it a `ComboBox` or whatever. You can use a default template for your data or use a custom template as shown above. You can even use a `ListView` along with a `GridView` if you want a multi-column list.

Problem

I'm not sure how else to describe this, outside of calling it a "newspaper" column. Essentially I have a potentially long list of codes that I want to display in a grid, and I have limited vertical real estate. I would like to show these codes (which are all from the same database column) in multiple columns, maybe 3-5 columns across. I can absolutely break the data up into separate sources and bind to them separately if that is the best solution, but I thought there might be an easy, built-in way to accomplish this with WPF.

Original source