为什么图像在网格面板中不自动调整大小?

发布于 2024-11-09 11:02:12 字数 1190 浏览 5 评论 0原文

我尝试制作一个带有表情混合的 wp7 应用程序。但有一个问题让我抓狂!

我创建了一个全景控制器、一个全景项目和一个网格。在此网格中,我创建了一个图像
在此处输入图像描述

为什么我的图像不会放大宽度

截图如下:
在此处输入图像描述
灰色图像也在 dx 处被圆化,就像 sx 侧一样。

这里是配置:
在此处输入图像描述

有没有解决方案可以放大图像的宽度(例如网格的最大尺寸)?

我该怎么做?

这是我的代码片段:

<controls:PanoramaItem Foreground="Black" >
  <Grid Margin="1,26,160,46" Width="418">
    [...]
    <Grid Margin="0,190,8,0" VerticalAlignment="Top" Height="207" >
      <Image Source="JobRow.png" Margin="8,34,27,50" Stretch="None" />
    </Grid>
  </Grid>
</controls:PanoramaItem>

有什么想法吗?

编辑1:如果我更改拉伸,这就是结果,我的图像仅在高度上放大!
好像在某个位置被挡住了...但我不知道为什么!

在此处输入图像描述

编辑 2:更改默认方向不会放大我的网格!

<controls:PanoramaItem Foreground="Black" Width="438" Orientation="Horizontal">

I tried to make a wp7 app with expression blend. But is there a problem that make me crazy!

I created a Panorama Controller, a Panorama Item and a Grid. In this grid i create an Image.
enter image description here

Why my image won't enlarge on width?

Here the screenshots:
enter image description here
The gray image is rounded also at dx, like sx side.

Here the config:
enter image description here

Is there a solution to enlarge my image on width like max size of grid?

How can I do this?

This is my snippet of code:

<controls:PanoramaItem Foreground="Black" >
  <Grid Margin="1,26,160,46" Width="418">
    [...]
    <Grid Margin="0,190,8,0" VerticalAlignment="Top" Height="207" >
      <Image Source="JobRow.png" Margin="8,34,27,50" Stretch="None" />
    </Grid>
  </Grid>
</controls:PanoramaItem>

Any idea please?

EDIT 1: if I change Stretch this is the result, my image enlarge only in height!
It's like that is blocked at certain position... but i don't know why!!!

enter image description here

EDIT 2: Changing default orientation will not enlarge my grid!

<controls:PanoramaItem Foreground="Black" Width="438" Orientation="Horizontal">

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

想念有你 2024-11-16 11:02:12

如果您希望图像增长以填充所有可用空间,则需要在图像上设置 Stretch 属性。根据您希望它如何扭曲或修剪以填充可用空间,您希望它是 FillUniformUniformToFill 之一。

编辑:
如果拉伸的图像现在超出了 PanoramaItem 的默认宽度,请务必将 PanoramaItem 的 Orientation 设置为 Horizo​​ntal,以便它可以支持所需的必要增长那个方向

You need to set the Stretch property on the image if you want it to grow to fill all the available space. Depending on how you want it to distort or get trimmed to fill the available space you want it to be one of Fill, Uniform or UniformToFill.

Edit:
If the stretched Image woudl now go beyond the default width of the PanoramaItem, be sure to set the Orientation of the PanoramaItem to be Horizontal so it can support the necessary growth needed in that direction

梦回梦里 2024-11-16 11:02:12

查看定义您正在编辑的 XAML 文件的属性(PageUserControl 等)。有这样的设定吗?

 d:DesignWidth="300"

如果是这样,请将其更改为更大的值,如下所示:

 d:DesignWidth="800"

Look at the properties that define the XAML file your are editing (Page, UserControl, etc.). Does it have a setting like this?

 d:DesignWidth="300"

If so, change it to a larger value like this:

 d:DesignWidth="800"
三岁铭 2024-11-16 11:02:12

只需从图像标签中删除边距属性

<Image Source="JobRow.png" Stretch="None" />

希望这有帮助

Just remove the margin attribute from your image tag

<Image Source="JobRow.png" Stretch="None" />

Hope this helps

攒一口袋星星 2024-11-16 11:02:12

好的,已解决从 XAML 文件中删除所有 Width="xxx",然后从 Expression Blend 手动调整所有组件的大小。

我不知道为什么,但它有效!

谢谢大家

Ok, solved removing all Width="xxx" from XAML file and after, from Expression Blend, manually resizing all the components.

I don't know why, but it works!

thanks all

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文