WPF:如何自动调整其容器的路径? [英] WPF: How to autosize Path to its container?

查看:38
本文介绍了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 和 Path to Fill 的 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:如何自动调整其容器的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆