我刚开始一个非常简单的WPF应用程序,它由一个主要的大图像和四个较小的图像组成。WPF XAML文件的奇怪问题
为了帮助布局,我创造了一些JPEG文件在MSPAINT包含图像-2
,-1
,0
,+1
和+2
,只是复制他们到项目目录的顶层。
的XAML段包含,五个图片:
<Image Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="4" Grid.RowSpan="1"
Margin="0,0,0,0" Name="imgPicture" Stretch="Fill" VerticalAlignment="Top"
Source="file:///C:/DAndS/Pax/MyDocs/VS2008/Projects/MyProj/zero.jpg" />
<Image Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="1" Grid.RowSpan="1"
Margin="0,0,0,0" Name="imgPicMinus2" Stretch="Fill" VerticalAlignment="Top"
Source="file:///C:/DAndS/Pax/MyDocs/VS2008/Projects/MyProj/minus2.jpg" />
<Image Grid.Column="2" Grid.Row="4" Grid.ColumnSpan="1" Grid.RowSpan="1"
Margin="0,0,0,0" Name="imgPicMinus1" Stretch="Fill" VerticalAlignment="Top"
Source="file:///C:/DAndS/Pax/MyDocs/VS2008/Projects/MyProj/minus1.jpg" />
<Image Grid.Column="3" Grid.Row="4" Grid.ColumnSpan="1" Grid.RowSpan="1"
Margin="0,0,0,0" Name="imgPicPlus1" Stretch="Fill" VerticalAlignment="Top"
Source="file:///C:/DAndS/Pax/MyDocs/VS2008/Projects/MyProj/plus1.jpg" />
<Image Grid.Column="4" Grid.Row="4" Grid.ColumnSpan="1" Grid.RowSpan="1"
Margin="0,0,0,0" Name="imgPicPlus2" Stretch="Fill" VerticalAlignment="Top"
Source="file:///C:/DAndS/Pax/MyDocs/VS2008/Projects/MyProj/plus2.jpg" />
当我尝试设置源属性为PLUS2图像,它与一个对话框,指出抱怨:
Property value is not valid.
Details
|
V
The file plus2.jpg is not part of the project or
its 'Build Action' property is not set to 'Resource'.
然而,如果我将文件重命名为plus3.jpg或plus2x.jpg,我没有这个问题。
为什么它特意抱怨plus2.jpg?
是否有可能您之前添加然后删除plus2.jpg? – AMissico 2010-06-10 07:47:12
您有没有可能在步骤之间建立了解决方案? – AMissico 2010-06-10 08:19:52
@AMissico,我不认为我添加/删除/添加。我试图设置该图像的源属性的_first_时间是当它抱怨时,即使它没有抱怨其他三个。我得看看重建。我现在所做的只是编辑XAML /布局,我甚至还没有试图运行它。你应该把这些评论作为答案,以防万一你是正确的。至少,你会得到一个帮助我的好消息,如果事实证明你是对的,你也会得到一个大绿剔。 – paxdiablo 2010-06-10 09:44:45