Welcome to the Xceed Community Sign in | Join | Help
Community Search  

Template for Vertical Grid

Sort Posts: Previous Next
  •  05-21-2007, 6:27 AM Post no. 8073

    Template for Vertical Grid

    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!
  •  05-21-2007, 9:10 AM Post no. 8074 in reply to 8073

    Re: Template for Vertical Grid

    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
    Odi Kosmatos
    VP, R&D, Xceed
  •  05-21-2007, 11:15 AM Post no. 8075 in reply to 8074

    Re: Template for Vertical Grid

    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.
  •  05-28-2007, 5:08 AM Post no. 8076 in reply to 8075

    Re: Template for Vertical Grid

    Is this so dificult that no one of your devolopers can answer?
  •  05-28-2007, 8:58 AM Post no. 8077 in reply to 8076

    Re: Template for Vertical Grid

    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).
    Marc Laroche
    Software Developer
    Xceed Software Inc.


    I don’t suffer from insanity, I enjoy every minute of it. - Unknown
  •  10-11-2007, 6:12 PM Post no. 8078 in reply to 8077

    Re: Template for Vertical Grid

    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?
  •  02-26-2008, 10:35 AM Post no. 8079 in reply to 8077

    Re: Template for Vertical Grid

    [@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
  •  02-26-2008, 3:06 PM Post no. 8080 in reply to 8079

    Re: Template for Vertical Grid

    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.
    Marc Laroche
    Software Developer
    Xceed Software Inc.


    I don’t suffer from insanity, I enjoy every minute of it. - Unknown
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2008 Xceed Software Inc.