我想创建一个
TextBlock
(或其他元素,其中包含文本仅用于显示)这是垂直的(-90变换角度),但我希望该元素填充其包含的垂直空间,但具有定义的水平量(我使用垂直和水平项,而不是高度和宽度,因为当我有
控件
我相信我知道如何做一个
控件
垂直使用
RenderTransform
或
LayoutTransform
. 然而,每当我改变容器的垂直方向时,我似乎无法使“停靠”正常工作
在水平方向而不是垂直方向上增加。
以下是我所拥有的:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
x:Class="AttendanceTracker.StudentView"
x:Name="UserControl" Height="172.666" Width="417.333">
<StackPanel x:Name="LayoutRoot" Orientation="Horizontal">
<Border BorderBrush="Black" BorderThickness="1" RenderTransformOrigin="0.5,0.5" Background="#52FFFFFF" Width="139.667">
<TextBlock Text="My Title" TextWrapping="Wrap" FontSize="18.667" TextAlignment="Center" Foreground="White" Margin="-58.509,68.068,49.158,70.734" Background="Black" RenderTransformOrigin="0.5,0.5" Width="147.017" d:LayoutOverrides="Height">
<TextBlock.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="-90"/>
<TranslateTransform/>
</TransformGroup>
</TextBlock.RenderTransform>
</TextBlock>
</Border>
</StackPanel>
更改UserControl的高度,您会注意到
控件
在水平方向而不是所需的垂直方向上增加。