0
我试图在XAML(对于Silverlight 2应用程序)中创建一个类似于groupbox的元素,但是有一个转折点。试图旋转groupbox的文本
通常情况下,组框会包含一个边框,主内容放置在边框内,标题内容放置在边框本身。
我想要做的是将标题文本放在左侧边框上,旋转270度并在顶部对齐。但是我的脑子因试图找出旋转变换而感到痛苦。
下面是我对现有的组框控件模板,我想改变其中:
<ControlTemplate TargetType="Controls1:GroupBox">
<Grid Background="{TemplateBinding Background}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border BorderThickness="{TemplateBinding BorderThickness}" Grid.Row="1" Grid.RowSpan="2"
BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="3">
<Border.Clip>
<GeometryGroup FillRule="EvenOdd">
<RectangleGeometry x:Name="FullRect" Rect="0,0,300,200"/>
<RectangleGeometry x:Name="HeaderRect" Rect="6,0,100,100"/>
</GeometryGroup>
</Border.Clip>
</Border>
<ContentPresenter Grid.Row="2" ContentTemplate="{TemplateBinding ContentTemplate}"
Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}"/>
<ContentControl x:Name="HeaderContainer" Margin="6,0,0,0" Grid.Row="0" Grid.RowSpan="2" HorizontalAlignment="Left" IsEnabled="False" >
<ContentPresenter Margin="3,0,3,0" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" />
</ContentControl>
</Grid>
</ControlTemplate>
任何帮助,非常感谢!
是啊,我得到了那么远,但它变得有点难它正确放置。 – 2009-05-28 21:16:53