Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the button content display vertically in WPF?

Recently I installed Visual Studio 2010 and I find that the content of the sidebar button goes vertically like the below image

Screenshot of vertical text for VS2010

My question is: is there a simple way to achieve this effect in WPF?

like image 305
fork123x Avatar asked Apr 03 '13 18:04

fork123x


2 Answers

Very easy, use LayoutTransform and RotateTransform:

<ToggleButton Content="Members Info" HorizontalAlignment="Right" 
              Click="btn_MembersInfo_Click">         
    <ToggleButton.LayoutTransform>
        <RotateTransform Angle="-90" />
</ToggleButton.LayoutTransform>
</ToggleButton>
like image 191
Adolfo Perez Avatar answered Nov 18 '22 23:11

Adolfo Perez


Will need to adjust Width Height and Center

<Button Content="RotatedButton" Width="200" Height="100">
    <Button.RenderTransform>
        <RotateTransform CenterX="0" CenterY="0" Angle="90" />
    </Button.RenderTransform>
</Button>
like image 43
paparazzo Avatar answered Nov 18 '22 23:11

paparazzo