【发布时间】:2016-06-11 08:49:22
【问题描述】:
我正在尝试将一些控件放在位于枢轴项目中的Grid 中。
到目前为止我添加的所有内容都会显示出来,但是带有默认图片的图片控件不可见。
我可以在设计编辑器中看到带有加载的默认图片的图片控件,但在应用程序运行时看不到。
应用程序启动时,只有按钮和椭圆可见。
这是我的 XAML 代码:
<phone:Pivot HorizontalAlignment="Left" Height="768" Grid.Row="1" Title="pivot" VerticalAlignment="Top" Width="480">
<phone:PivotItem CacheMode="{x:Null}" Header="Home" Margin="10,10,-235,-578">
<Grid HorizontalAlignment="Left" Height="576" Margin="10,10,0,0" VerticalAlignment="Top" Width="438">
<Image Source="Images/DefaultProfilePic.jpg" HorizontalAlignment="Left" Height="100" Margin="32,35,0,0" VerticalAlignment="Top" Width="100"/>
<Button Content="Button" HorizontalAlignment="Left" Margin="32,183,0,0" VerticalAlignment="Top"/>
<Ellipse Fill="#FFF4F4F5" HorizontalAlignment="Left" Height="100" Margin="32,292,0,0" Stroke="Black" VerticalAlignment="Top" Width="100"/>
</Grid>
</phone:PivotItem>
<phone:PivotItem CacheMode="{x:Null}" Header="Search">
<Grid/>
</phone:PivotItem>
<phone:PivotItem CacheMode="{x:Null}" Header="My Profile">
<Grid/>
</phone:PivotItem>
</phone:Pivot>
【问题讨论】:
-
镜像是否也复制到部署版本?
-
是的,图片被复制到“Images”文件夹中。我已经通过 Visual Studio 中的“添加现有项目”导入了它。
-
是的,但是当您点击图片属性时,您可以设置
Copy to Output Directory -
试试这个
<Image Source="/Images/DefaultProfilePic.jpg" /> -
我将 coppy 设置为输出目录和
<Image Source="/Images/DefaultProfilePic.jpg" />。它奏效了!非常感谢:)
标签: c# .net wpf windows-phone-8.1