垂直文本框没有填满所有空间 - Windows 8.1

时间:2015-10-15 08:59:46

标签: xaml windows-store-apps textblock

我有这个数据模板用于Listview中的项目,它是一堆行,有4列,而在第一列我试图添加垂直显示的文本。到目前为止,我有这个,文本显示在垂直,但由于某种原因,它显示切割到底。

    <DataTemplate x:Key="ActionItemTemplate">
    <Grid Height="150" HorizontalAlignment="Left"  >
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="60"/>
            <ColumnDefinition Width="470"/>
            <ColumnDefinition Width="470"/>
            <ColumnDefinition Width="100"/>
        </Grid.ColumnDefinitions>

        <Grid Grid.Column="0" Background="Tomato">
            <TextBlock Text="In Progress" RenderTransformOrigin="0.5,0.5" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center">
                <TextBlock.RenderTransform>
                    <RotateTransform Angle="-90" />
                </TextBlock.RenderTransform>
            </TextBlock>
        </Grid>

        <Grid Grid.Column="1" Background="Blue"></Grid>
        <Grid Grid.Column="2" Background="Green"></Grid>
        <Grid Grid.Column="3" Background="Yellow"></Grid>

    </Grid>
</DataTemplate>

enter image description here

我需要添加任何内容吗?

1 个答案:

答案 0 :(得分:2)

我用blend来修改你的代码,这是结果 enter image description here

这是代码:

      <Grid Grid.Column="0" Background="Tomato">
                <TextBlock Text="In Progress In Progress In Progress "  RenderTransformOrigin="0.5,0.5" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" Height="19" Margin="-149.5,65.5,-155.5,65.5" UseLayoutRounding="False" d:LayoutRounding="Auto">
                        <TextBlock.RenderTransform>
                            <RotateTransform Angle="-90" />
                        </TextBlock.RenderTransform>
                    </TextBlock>
                </Grid>

你应该尝试一下