垂直放置TabControl

时间:2010-10-23 10:51:28

标签: xaml silverlight controls silverlight-3.0

如何制作Silverlight TabControl垂直排列标签?

2 个答案:

答案 0 :(得分:4)

TabControl格式化(右对齐和垂直文本)

<Controls2:TabControl HorizontalContentAlignment="Right" HorizontalAlignment="Right" TabStripPlacement="Left"></Controls2:TabControl> 

答案 1 :(得分:0)

确保已安装silverlight工具包,然后使用旋转布局转动标签页眉。

<UserControl xmlns:controls=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls” 
x:Class=”SilverlightApplication18.MainPage”
xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation“
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml“
xmlns:toolkit=”clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit”            
Width=”400″ Height=”300″>
<Grid x:Name=”LayoutRoot” Background=”White”>
    <controls:TabControl Margin=”10″ TabStripPlacement=”Left”>
        <controls:TabItem  >
            <controls:TabItem.Header>
                <toolkit:LayoutTransformer >
                    <TextBlock Text=”Tab1″/>
                    <toolkit:LayoutTransformer.LayoutTransform>
                        <RotateTransform Angle=”-90″></RotateTransform>
                    </toolkit:LayoutTransformer.LayoutTransform>
                </toolkit:LayoutTransformer>
            </controls:TabItem.Header>
            <TextBlock  Margin=”10″ Text=”some content in Tab1″/>               
        </controls:TabItem>

结果如下: Vertical tab layout

可能我无法上传图片,结果会是这样,但所有文字在实际结果中都会旋转-90。

+--+------------------------------
|l |
|a |
|c |
|i |
|t |
|r |
|e |
|v |
+--+
|
|
+--------------------------------

相关文章为here