gpt4 book ai didi

c# - Image ComboBox XAML 在运行时无法正确显示

转载 作者:太空宇宙 更新时间:2023-11-03 15:36:43 25 4
gpt4 key购买 nike

我正在尝试实现一个只有图像的组合框。图像不需要是动态的。我目前正在这样做:

<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

已编辑:添加了错误消息

问题已解决 - 将构建操作更改为“资源”并重新构建解决方案似乎可以解决问题。

最佳答案

问题已解决 - 将构建操作更改为“资源”并重新构建解决方案似乎可以解决问题。

关于c# - Image ComboBox XAML 在运行时无法正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31671839/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com