垂直对齐PathListBox的内容

时间:2011-12-17 11:24:54

标签: wpf xaml vertical-alignment blend

我有一个包含Blend SDK的PathListBox的控件(参见下面的XAML)。里面的物品具有相同的宽度和不同的高度。目前,项目的中点遵循弧的路径(见图),即它们明显垂直排列'中心'。但是,我希望项目'top'垂直对齐,因此它们的顶部遵循弧的路径。我怎么能这样做?

enter image description here

<Grid x:Name="LayoutRoot">
    <ec:PathListBox Margin="160,290,-30,-250">
        <ec:PathListBox.LayoutPaths>
            <ec:LayoutPath SourceElement="{Binding ElementName=arc}" 
                Padding="-25"  FillBehavior="NoOverlap" 
                Distribution="Even"  Span="0.5"/>
        </ec:PathListBox.LayoutPaths>
        <Rectangle Fill="#FFF4F4F5" Height="103" Width="100"/>
        <Rectangle Fill="#FFF4F4F5" Height="120" Width="100"/>
        <Rectangle Fill="#FFF4F4F5" Height="140" Width="100"/>
        <Rectangle Fill="#FFF4F4F5" Height="265" Width="100"/>
        <Rectangle Fill="#FFF4F4F5" Height="100" Width="100"/>
        <Rectangle Fill="#FFF4F4F5" Height="265" Width="100"/>
    </ec:PathListBox>
    <ed:Arc x:Name="arc" 
        ArcThickness="10"  ArcThicknessUnit="Pixel"  Margin="160,290,-30,-250" 
        Stretch="None"  Stroke="Transparent"  StartAngle="-7" 
        RenderTransformOrigin="0.5,0.5"  StrokeThickness="3" 
        Opacity="0.155" Fill="LightGray">
        <ed:Arc.RenderTransform>
            <TransformGroup>
                <ScaleTransform ScaleY="1" ScaleX="-1"/>
                <SkewTransform AngleY="-17" AngleX="-16"/>
                <RotateTransform Angle="0"/>
                <TranslateTransform/>
            </TransformGroup>
        </ed:Arc.RenderTransform>
    </ed:Arc>
</Grid>

1 个答案:

答案 0 :(得分:1)

只需改变你的作品的边距:

...
<Rectangle Fill="Green" Height="103" Width="100" Margin="0,130,0,0"/>
<Rectangle Fill="Green" Height="120" Width="100" Margin="0,120,0,0"/>
<Rectangle Fill="Green" Height="140" Width="100" Margin="0,140,0,0"/>
<Rectangle Fill="Green" Height="265" Width="100" Margin="0,265,0,0"/>
<Rectangle Fill="Green" Height="100" Width="100" Margin="0,100,0,0"/>
<Rectangle Fill="Green" Height="265" Width="100" Margin="0,265,0,0"/>
...

我自己在Blend4上尝试它并且它有效。