Home Forums WPF controls Xceed DataGrid for WPF Template for Vertical Grid

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #23147 |

    Hi,
    is there some way to transform the grid so that columns become rows and rows become columns, making it a Vertical grid instead of horizontal?

    This way I could create new items by adding columns instead of rows.

    If it’s not possible out of the box could you give me some pointers on how to make a template that makes this possible?

    Thank you!

    Imported from legacy forums. Posted by Hugo (had 7330 views)

    Odi [Xceed]
    Spectator
    Post count: 426

    I saw this done a couple of years back when the grid was still being designed. It should be as easy as switching a vertical StackPanel with a horizontal one (if I remember correctly) somewhere in the visual tree. I know that this is going to be in one of the upcoming samples, though. Let’s see if one of the developers can point you in the right direction (it won’t today though, it is a Canadian holiday).

    Odi

    Imported from legacy forums. Posted by Odi [Xceed] (had 304 views)

    User (Old forums)
    Member
    Post count: 23064

    Uau that is really good news. I thought it would be a very difficult thing to do.

    I hope to hear more on this from you guys.

    Thank you.

    Imported from legacy forums. Posted by Hugo (had 509 views)

    User (Old forums)
    Member
    Post count: 23064

    Is this so dificult that no one of your devolopers can answer?

    Imported from legacy forums. Posted by Hugo (had 431 views)

    Xceed Support
    Member
    Post count: 5658

    Thank you for your patience. Last week was a busy one, and since the developers are supporting this forum out of their “spare” time for the sake of the WPF community ( since the DataGrid for WPF is provided freely without support), answering was not immediately possible.

    As for your question about setting the Grid vertical… Here are the few basic steps you would need to do to make this work:

    – Replace the DataRow’s ControlTemplate with one where the cells are stacked Vertically instead of horizontally (done by applying an implicit style on DataRow).
    – Replace the ColumnManagerRow’s ControlTemplate with one where the cells are stacked Vertically instead of horizontally (done by applying an implicit style on ColumnManagerRow).
    – Replace the InsertionRow’s ControlTemplate with one where the cells are stacked Vertically instead of horizontally (done by applying an implicit style on InsertionRow).
    – Replace the DataGridControl’s ItemsPanel with an ItemsPanelTemplate that layout its children Horizontally instead of Vertically ( you could set the Orientation property on the Xceed.Wpf.DataGrid.VirtualizingStackPanel ).
    – Replace the TableViewScrollViewer’s ControlTemplate with one where the FixedHeadersHostPanel is located on the Left side and the FixedFootersHostPanel on the right size, and where they are layouting their children Horizontally.

    In order to achieve this, you can start from the Styles and Templates provided along with the package ( Xceed DataGrid for WPF 1.1\Themes folder).

    Imported from legacy forums. Posted by Marcus [Xceed] (had 796 views)

    User (Old forums)
    Member
    Post count: 23064

    I am new to this DataGrid, and my boss insist that we need to figure out how to switch between horizontal and vertical view. Could you give us a little bit more detail on how to do it? or is there sample somewhere I can read it?

    Imported from legacy forums. Posted by sam (had 440 views)

    User (Old forums)
    Member
    Post count: 23064

    [@Marcus] Thanks a lot for your detailed solution. It helped me a lot in writing my own set of styles.

    However (and just for the record), there are a few drawbacks. The one of which I was working on right now and for which I don’t see a workaround is the ColumnManagerCell’s implemenation of the DragDelta event which just looks at the HorizontalChange value. This means that even in a vertical view, the ColumnManagerCell’s thumb modifies cell widths instead of cell heights.

    Kuno

    Imported from legacy forums. Posted by Kuno (had 1317 views)

    Xceed Support
    Member
    Post count: 5658

    Hi Kuno,

    The default styles of Cells bind the Cell.Width to the ParentColumn.Width.

    While it is true that the property itself remains with the Width name, what you could do is create a style for each Cell types and explicitelly override the Width binding and replace it with a Height binding:

    <Style TargetType=”{x:Type eachCellTypeUsed}” >
    <Setter Property=”Width” Value=”NaN” />
    <Setter Property=”Height” Value=”{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.Width}/>
    </Style>

    Something that looks like this should do the trick.

    Imported from legacy forums. Posted by Marcus [Xceed] (had 5753 views)

    User (Old forums)
    Member
    Post count: 23064

    Is there an example template or a sample reproducing a Vertical grid available somewhere? I’m having trouble modifying the Template even with Marcus’ instructions.

    And how many packets of Gummy Bears do I have to send to get access to it ? 🙂

    Imported from legacy forums. Posted by Eric (had 3999 views)

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.