为什么图像在网格面板中不自动调整大小?
我尝试制作一个带有表情混合的 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.
Why my image won't enlarge on width?
Here the screenshots:
The gray image is rounded also at dx, like sx side.
Here the config:
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!!!
EDIT 2: Changing default orientation will not enlarge my grid!
<controls:PanoramaItem Foreground="Black" Width="438" Orientation="Horizontal">
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您希望图像增长以填充所有可用空间,则需要在图像上设置
Stretch
属性。根据您希望它如何扭曲或修剪以填充可用空间,您希望它是Fill
、Uniform
或UniformToFill
之一。编辑:
如果拉伸的图像现在超出了 PanoramaItem 的默认宽度,请务必将 PanoramaItem 的
Orientation
设置为Horizontal
,以便它可以支持所需的必要增长那个方向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 ofFill
,Uniform
orUniformToFill
.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 beHorizontal
so it can support the necessary growth needed in that direction查看定义您正在编辑的 XAML 文件的属性(
Page
、UserControl
等)。有这样的设定吗?如果是这样,请将其更改为更大的值,如下所示:
Look at the properties that define the XAML file your are editing (
Page
,UserControl
, etc.). Does it have a setting like this?If so, change it to a larger value like this:
只需从图像标签中删除边距属性
希望这有帮助
Just remove the margin attribute from your image tag
Hope this helps
好的,已解决从 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