0

I am working with a inverted DataGrid (columns => rows). When I'm scrolling down, the elements are cropped horizontally instead of vertically as it is expected. I supposed that the problem is coming from the scrollviewer and it's ContentHorizontalOffset. As it is inverted, it should be vertical.

What I am getting:

enter image description here

What I want:

enter image description here

How can I change that ?

Here some code of what I am doing (based on this and this ):

<DataGrid x:Name="MyRotatedDataGrid" HorizontalContentAlignment="Center"
                     ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible" 
                     AutoGenerateColumns="True"
                     ItemsSource="{Binding Customers}">
            <DataGrid.Resources>
                <Style x:Key="DataGridBase" TargetType="Control">
                    <Setter Property="LayoutTransform">
                        <Setter.Value>
                            <TransformGroup>
                                <RotateTransform Angle="-90" />
                                <ScaleTransform ScaleX="1" ScaleY="-1" />
                            </TransformGroup>
                        </Setter.Value>
                    </Setter>
                    <Setter Property="TextOptions.TextFormattingMode" Value="Display" />
                </Style >
                <Style TargetType="DataGridCell" BasedOn="{StaticResource DataGridBase}"/>
                <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource DataGridBase}"/>
                <Style TargetType="DataGridRowHeader" BasedOn="{StaticResource DataGridBase}"/>
            </DataGrid.Resources>

            <DataGrid.LayoutTransform>
                <TransformGroup>
                    <RotateTransform Angle="90" />
                    <MatrixTransform Matrix="-1, 0, 0, 1, 0, 0" />
                </TransformGroup>
            </DataGrid.LayoutTransform>
Community
  • 1
  • 1
Morgane
  • 123
  • 2
  • 13
  • I just found that the responsible of this is setting the DataGridCell. Applying a transform into it will change the scrollviewer. – Morgane Oct 20 '15 at 22:10
  • Possible duplicate of [Datagrid - Scrolling will crop images horizontally instead of vertically](http://stackoverflow.com/questions/32877314/datagrid-scrolling-will-crop-images-horizontally-instead-of-vertically) – Morgane Oct 29 '15 at 17:17

0 Answers0