我正在尝试使用仅包含图像的组合框。图像不需要是动态的。我现在这样做:
<ComboBox HorizontalAlignment="Center" x:Name="diceDot" Canvas.Left="244" Canvas.Top="10" Height="20" Width="40">
<ComboBoxItem>
<Image Stretch="Fill" Source="Resources/dice1.png" Height="20" Width="20"></Image>
</ComboBoxItem>
<ComboBoxItem>
<Image Stretch="Fill" Source="Resources/dice2.png" Height="20" Width="20"></Image>
</ComboBoxItem>
<ComboBoxItem>
<Image Stretch="Fill" Source="Resources/dice3.png" Height="20" Width="20"></Image>
</ComboBoxItem>
<ComboBoxItem>
<Image Stretch="Fill" Source="Resources/dice4.png" Height="20" Width="20"></Image>
</ComboBoxItem>
<ComboBoxItem>
<Image Stretch="Fill" Source="Resources/dice5.png" Height="20" Width="20"></Image>
</ComboBoxItem>
<ComboBoxItem>
<Image Stretch="Fill" Source="Resources/dice6.png" Height="20" Width="20"></Image>
</ComboBoxItem>
</ComboBox>
但是,图像在运行时没有出现。它确实在设计过程中完美呈现了预期的结果。我不希望带有图像的文件夹与我的可执行文件一起出现。
错误:
A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.IO.DirectoryNotFoundException' occurred in mscorlib.dll
已编辑:已添加错误消息
问题已修复 - 将构建操作更改为“资源”并重建解决方案似乎可以解决问题。
答案 0 :(得分:0)
问题已修复 - 将构建操作更改为“资源”并重建解决方案似乎解决了问题。