本文介绍了WPF:如何自动调整其容器路径的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个必须调整为其StackPanel容器大小的路径.
I have a Path that must resize to its StackPanel container.
<StackPanel x:Name="TrackSurface">
<Path Fill="AliceBlue"
Stroke="Black" StrokeThickness="1"
Data="{StaticResource TranslateZ}">
</Path>
</StackPanel>
我考虑使用绑定到容器的转换,但实际上不知道如何进行转换.有人可以给我提示吗?
I think about using a transformation bound to the container but don't know how to it actually. Can someone give me hint?
推荐答案
我将Stackpanel更改为要填充的路径"的Grid and Stretch属性.
I changed the Stackpanel to Grid and Stretch property of the Path to Fill.
<Grid x:Name="TrackSurface">
<Path Fill="AliceBlue"
Stretch="Fill"
Stroke="Black" StrokeThickness="1"
Data="M148,28 C221,133 110.50025,119.5 110.50025,119.5 L124.50016,68.5 z">
</Path>
这篇关于WPF:如何自动调整其容器路径的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!