开发者

Create a repeat symbol in XAML / WPF

I need to create a repeat symbol in XAML / WPF (procedural code would be ok too, though I'd prefer XAML if possible), something like the following, but I just need the not finished circle with the arrow (the white drawing in the button): http://www.vista-style-icons.com/libs/phone/repeat.htm

I know how to cr开发者_StackOverfloweate a circle in XAML, but I don't know how to create a not finished circle and add an arrow to the open end? Thank you for any help!


You can create an unfinished circle by using an ArcSegment as a path segment in a Path shape. You specify the start and end point of the arc and the radius of the entire circle. You can render it on top of a blue circle by putting them in a grid:

<Grid Width="160" Height="160">
    <Ellipse Fill="Blue"/>
    <Path StrokeThickness="5" Stroke="White">
        <Path.Data>
            <PathGeometry>
                <PathFigure StartPoint="115,45">
                    <ArcSegment Point="115,115" Size="50,50" IsLargeArc="True"/>
                </PathFigure>
            </PathGeometry>
        </Path.Data>
    </Path>
    <Polygon Points="115,115 105,105 125,105 125,125" Fill="White"/>
</Grid>

You can also use the shorter Path Markup Syntax to create a StreamGeometry rather than a PathGeometry:

<Grid Width="160" Height="160">
    <Ellipse Fill="Blue"/>
    <Path Data="M 115,45 A 50,50 0 1 0 115,115"
        StrokeThickness="5" Stroke="White"/>
    <Polygon Points="115,115 105,105 125,105 125,125" Fill="White"/>
</Grid>

You'll need to work on it to get exactly the look you want, but that should give you the basic technique for drawing an unfinished circle with an arrow.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜