Change orientation of text in GridViewColumnGroup

2 posts, 0 answers
  1. Rob
    Rob avatar
    10 posts
    Member since:
    Nov 2012

    Posted 11 Nov 2012 Link to this post

    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>

  2. Yoan
    Admin
    Yoan avatar
    1215 posts

    Posted 15 Nov 2012 Link to this post

    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.

Back to Top