如何告诉WPF Path Canvas边界?

时间:2016-05-17 21:22:58

标签: wpf xaml

我正在尝试绘制一个减号,基于100x100的画布,但我最终得到一个正方形,因为WPF不知道我的画布有多大。如何判断路径容器大小?

 <ObjectAnimationUsingKeyFrames Storyboard.TargetName="CheckIcon"
                               Storyboard.TargetProperty="Data">
                        <DiscreteObjectKeyFrame KeyTime="0">
                            <DiscreteObjectKeyFrame.Value>
                                <PathGeometry >
                                    <PathFigure StartPoint="20,60">
                                        <LineSegment Point="20,60"/>
                                        <LineSegment Point="80,60"/>
                                        <LineSegment Point="80,45"/>
                                        <LineSegment Point="20,45"/>
                                    </PathFigure>
                                </PathGeometry>
                            </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                    </ObjectAnimationUsingKeyFrames>

1 个答案:

答案 0 :(得分:0)

这不直观,但克莱门斯帮助我找到答案

<PathGeometry>
    <PathFigure>
        <LineSegment Point="0,0" IsStroked="False"/>
        <LineSegment Point="20,60" IsStroked="False"/>
        <LineSegment Point="20,60"/>
        <LineSegment Point="20,60"/>
        <LineSegment Point="80,60"/>
        <LineSegment Point="80,45"/>
        <LineSegment Point="100,100" IsStroked="False"/>
        <LineSegment Point="80,45" IsStroked="False"/>
        <LineSegment Point="20,45"/>
        <LineSegment Point="20,60"/>
    </PathFigure>
</PathGeometry>