This is a migrated thread and some comments may be shown as answers.

Change orientation of text in GridViewColumnGroup

1 Answer 44 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 12 Nov 2012, 12:05 AM
Hi there,

Is it possible to change to easily change the GridViewColumnGroup text orientation to vertical?

I've got the following code working to some degree:

<DataTemplate x:Key="VerticalTemp">
        <TextBlock Text="{Binding}" TextWrapping="NoWrap" TextAlignment="Left" RenderTransformOrigin="0,0" VerticalAlignment="Stretch">
                <TextBlock.RenderTransform >
                    <CompositeTransform Rotation="-90" TranslateX="0" TranslateY="50"/>
                </TextBlock.RenderTransform>
          </TextBlock>
      </DataTemplate>
      <Style x:Key="VerticalStyle" TargetType="telerik:CommonColumnHeader">
          <Setter Property="Height" Value="300" />
      </Style>

But it seems that the Width of the grid column is affecting the group heading text as though it wasn't rotated, that is to say; if the column is not wide enough to accommodate the text in the group heading in horizontal (0 degrees rotation) it cuts it off, even though when rotated -90 degree there is plenty of height in the heading to accommodate it.

Any help would be greatly appreciated.


EDIT:

I managed to get this sorted by rotating the Textbox's Canvas rather than the textbox itself:

<DataTemplate x:Key="VerticalTemp">
            <Canvas RenderTransformOrigin="0.5,0.5" VerticalAlignment="Stretch" HorizontalAlignment="Left">
                <Canvas.RenderTransform>
                    <CompositeTransform Rotation="-90" TranslateX="0" TranslateY="50"/>
                </Canvas.RenderTransform>
                <TextBlock Text="{Binding}" HorizontalAlignment="Left" VerticalAlignment="Top">
                </TextBlock>
            </Canvas>
      </DataTemplate>

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 15 Nov 2012, 08:48 AM
Hi Rob,


I am glad to hear that you have solved your problem. Thank you for sharing your solution to the community.

 

Greetings,
Yoan
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Rob
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or