线条不是从文本块绘制到另一个画布内的另一个文本块

时间:2013-09-16 13:08:15

标签: wpf canvas wpf-controls

 <StackPanel Margin="20">
    <Line StrokeDashArray="4 4" Stroke="Red" X1="0" Y1="0" X2="{Binding LeftPoint}" Y2="{Binding TopPoint}"></Line>
        <TextBlock Text="Hello"></TextBlock>
    <Border Height="100"></Border>
    <Canvas Name="B" >
        <Border Height="48"></Border>
        <TextBlock Canvas.Left="{Binding LeftPoint, Mode=TwoWay}"  Canvas.Top="{Binding TopPoint, Mode=TwoWay}" Text="World"></TextBlock>
    </Canvas>
</StackPanel>

上面是代码示例,行不是从hello到world。我想保留结构,仍然能够划线。

请建议。

1 个答案:

答案 0 :(得分:0)

我猜你错过了StrokeThickness

 <Line StrokeDashArray="4 4" 
       Stroke="Red" StrokeThickness="1"
       X1="0" X2="{Binding LeftPoint}"
       Y1="0" Y2="{Binding TopPoint}"/>