正确设置窗口图标并发生XamlParseException

时间:2015-03-08 14:15:34

标签: c# wpf

我在一个非常简单的wpf应用程序中正确地在xaml代码或属性窗口中设置了window icon属性,但是visual studio总是在运行时抛出一个XamlParseException。为什么会发生这种情况?(使用visual studio 2013和Windows 8,我的图标大小为15 KB)

<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525" Icon="pack://siteoforigin:,,,/Resources/MyIcon.ico">
<Grid>

</Grid> </Window>

<Window x:Class="WpfApplication1.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525" Icon="/Resources/MyIcon.ico">
<Grid>

</Grid> </Window>

enter image description here

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:4)

图像构建操作属性存在问题,请检查箭头以获取更多信息..

enter image description here