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

Header for Left/Right Expand

3 Answers 99 Views
Expander
This is a migrated thread and some comments may be shown as answers.
Andy
Top achievements
Rank 1
Andy asked on 03 Sep 2008, 03:42 PM
Hello,
I am trying to orient the content of the Header (just text) to be rotated 90 or -90 depending on the ExpandDirection.

I have created a DataTemplate with a Grid containing a TextBlock.

The Grid uses RotateTransform to draw itself vertically.

The text draws correctly but I am having trouble getting the header to re-size correctly.  It seems to size itself based on the initial width of the textblock's text and not the height of the text after the textbox is rotated.

Here is the code for the HeaderTemplate
<Grid Background="#FF292C29" RenderTransformOrigin="0.5,0.5">
    <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center"            TextWrapping="Wrap" FontSize="12" Foreground="#FFF7F3F7" Text="Activities" />
   <Grid.RenderTransform>
         <RotateTransform Angle="90"></RotateTransform>
   </Grid.RenderTransform>
</Grid>

I would like the grid to expand and have the same height as the RadExpander object, yet only be as wide as the text's size plus margin.

Any suggestions?

Thanks for your time
-Andy

3 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 04 Sep 2008, 06:22 PM
Hi Andy,

The problem here is that when you use the RenderTransform the new size is not part of the layout calculations.

Can't you use fixed size for the container Grid element ( set the Width and Height properties)?

Sincerely yours,
Valentin.Stoychev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chiara
Top achievements
Rank 1
answered on 24 Oct 2011, 09:44 AM
Hi Valentin, 
I have a problem with the expander's style.
I have changed the default style of windows7 radexpander, but now I want to create three more:
one expander on the right, one on the left and one at the bottom.

If I change the RenderTrasform property on the ContentPresenter, it also change the expander's content (not only the togglebutton).
How to rotate only the togglebutton and the expander's animation?

Is it possible?
Thank you very much
-Chiara

Here you can find my example: Expander Style


0
Petar Mladenov
Telerik team
answered on 27 Oct 2011, 11:45 AM
Hello Chiara,

 We used LayoutTransformControl in order to achieve the Rotations you needed:

<!-- add LayoutTransformControl -->
<telerikPrimitives:LayoutTransformControl RenderTransformOrigin=".5 .5"
        x:Name="HeaderContentButton" >
 
    <Grid x:Name="HeaderPanel" Background="Transparent">
        <Grid.RowDefinitions>
Please examine the modified solution and let us know if it satisfies you. Regards,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Expander
Asked by
Andy
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
Chiara
Top achievements
Rank 1
Petar Mladenov
Telerik team
Share this question
or