1

PathFigurexamlで from resources inPathGeometry要素を使用する方法はあるのでしょうか。ResourceDictionary と、PathFigureその中に「x:Key」属性がそれぞれ「Figure1」と「Figure2」に等しい 2 つのオブジェクトがあるとします。私の目標は、Figure1 と Figure2 を含むコレクションで満たされたPathGeometrywithプロパティを作成することです。Figuresコードビハインドファイルを使用すると簡単に実行できますが、xaml のみで実行する方法があることを知りたいです。

<PathFigure IsClosed="True" StartPoint="2,9" x:Key="Figure1">
    <ArcSegment Point="15,9" Size="6.5, 2"/>
    <LineSegment Point="15,12"/>
    <ArcSegment Point="2,12" Size="6.5, 2"/>
</PathFigure>

<PathFigure IsClosed="True" StartPoint="10,7" x:Key="Figure2">
    <LineSegment Point="10, 2"/>
    <LineSegment Point="13,2"/>
    <LineSegment Point="13,7"/>
    <ArcSegment Point="10,7" Size="2,2" IsLargeArc="True"/>
</PathFigure>

私は今作成することができますPathGeometry

<PathGeometry FillRule="Nonzero" x:Key="1">
    <PathFigureCollection>
        //Here I want to put Figure1 and Figure2
    </PathFigureCollection>
</PathGeometry>

次のことを行うために何らかの書き込みができると思いますMarkupExtensionが、最善の方法を探しています。アドバイスありがとうございます。

4

1 に答える 1