Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Path in a DrawingImage?

Tags:

wpf

xaml

drawing

I have some paths defined that I would like to convert into DrawingImage resources but I must be missing something.

i.e.

I want to take something like this:

<Path Stroke="DarkGoldenRod" StrokeThickness="3" 
      Data="M 100,200 C 100,25 400,350 400,175 H 280" />

and use it with something like this:

<DrawingImage x:Key='icon'>
    <DrawingImage.Drawing>
      <DrawingGroup>
        <DrawingGroup.Children>
          <GeometryDrawing ... />
          . . .
        </DrawingGroup.Children>
      </DrawingGroup>
    </DrawingImage.Drawing>
</DrawingImage>

Any suggestions?

-dk

like image 642
dk. Avatar asked Sep 22 '09 04:09

dk.


1 Answers

This should work :

<DrawingImage x:Key='icon'>
  <DrawingImage.Drawing>
    <DrawingGroup>
      <DrawingGroup.Children>
        <GeometryDrawing Geometry="M 100,200 C 100,25 400,350 400,175 H 280">
          <GeometryDrawing.Pen>
            <Pen Thickness="3" Brush="DarkGoldenRod"/>
          </GeometryDrawing.Pen>
        </GeometryDrawing>
      </DrawingGroup.Children>
    </DrawingGroup>
  </DrawingImage.Drawing>
</DrawingImage>
like image 53
Thomas Levesque Avatar answered Sep 28 '22 02:09

Thomas Levesque