Rotating Text in WPF using VB.NET
This article defines that how to rotate Text in the WPF and XAML.
This article defines that how to rotate Text in the WPF and XAML.
Rotating Text in WPF
To show the rotating text in WPF we take a TextBlock Control on the form and select the TextBlock control and press F4 to property window and add some text to the control which will show as the rotating text.
XAML code
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Canvas>
<TextBlock Name="MyRotatingText" Margin="20" Width="640" Height="100" FontSize="48" FontWeight="Bold" Foreground="Tomato" Canvas.Left="-21" Canvas.Top="0">
This is a TextBlock control
<TextBlock.RenderTransform>
<RotateTransform x:Name="MyRotateTransform" Angle="0" CenterX="230" CenterY="25"/>
</TextBlock.RenderTransform>
<TextBlock.Triggers>
<EventTrigger RoutedEvent="TextBlock.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="MyRotateTransform"
Storyboard.TargetProperty="(RotateTransform.Angle)"
From="0.0" To="360" Duration="0:0:10"
RepeatBehavior="Forever" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</TextBlock.Triggers>
</TextBlock>
</Canvas>
</Window>
The window form looks like the below figure.
Figure1.gif
Now run the application and test it.
Figure2.gif