Ray*_*rns 73
还没有人提到使用纯XAML垂直堆叠任意字符串的字母(不旋转它们)的明显和简单的方法:
<ItemsControl
  ItemsSource="Text goes here, or you could use a binding to a string" />
这通过识别字符串是IEnumerable的事实来简单地垂直布局文本,因此ItemsControl可以将字符串中的每个字符视为单独的项目.ItemsControl的默认面板是StackPanel,因此字符是垂直布局的.
注意:为了精确控制水平定位,垂直间距等,可以在ItemsControl上设置ItemContainerStyle和ItemTemplate属性.
esk*_*o22 22
以防任何人仍然遇到这篇文章......这是一个简单的100%xaml解决方案.
    <TabControl TabStripPlacement="Left">
        <TabItem Header="Tab 1">
            <TabItem.LayoutTransform>
                <RotateTransform Angle="-90"></RotateTransform>      
            </TabItem.LayoutTransform>
            <TextBlock> Some Text for tab 1</TextBlock>
        </TabItem>
        <TabItem Header="Tab 2">
            <TabItem.LayoutTransform>
                <RotateTransform Angle="-90"></RotateTransform>
            </TabItem.LayoutTransform>
            <TextBlock> Some Text for tab 2</TextBlock>
        </TabItem>
    </TabControl>
Mic*_*cah 18
我认为通过改变系统固有的文本方式来实现这一目标并不是一件好事.最简单的解决方案是更改文本块的宽度并提供一些额外的属性,如下所示:
<TextBlock TextAlignment="Center" FontSize="14" FontWeight="Bold" Width="10" TextWrapping="Wrap">THIS IS A TEST</TextBlock>
这很hacky,但确实有效.
lun*_*tix 11
只需使用简单的LayoutTransform ..
<Label Grid.Column="0" Content="Your Text Here" HorizontalContentAlignment="Center">
  <Label.LayoutTransform>
    <TransformGroup>
        <RotateTransform Angle="90" />
        <ScaleTransform ScaleX="-1" ScaleY="-1"/>
    </TransformGroup>
  </Label.LayoutTransform>
</Label>
| 归档时间: | 
 | 
| 查看次数: | 57854 次 | 
| 最近记录: |