Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF: how to make a path's size conform to its parent's size

Tags:

c#

wpf

xaml

Let's say in blend I take the pen tool and I just create a closed shape.

I'd like to then make this shape's width (or height) stretch to its container's dimensions.

So let's say I have

<Grid Width="500">
    <Path Data="Bla Bla" Width="200">
</Grid>

In other words, how can I make the path's width conform to its parent. I try to just go

<Canvas Width="500">
    <Path Data="Bla Bla" HorizontalAlignment="Stretch">
</Canvas>

but that doesn't work. it works with a rectangle but not with a path, so how can I do it with a path?

like image 625
Shai UI Avatar asked Feb 24 '11 17:02

Shai UI


1 Answers

<Viewbox>
    <Path .../>
</Viewbox>
like image 126
Kent Boogaart Avatar answered Oct 18 '22 06:10

Kent Boogaart