【问题标题】:Set window icon correctly and happening XamlParseException正确设置窗口图标并发生 XamlParseException
【发布时间】:2015-07-17 01:22:24
【问题描述】:

我在一个非常简单的 wpf 应用程序中正确设置了 xaml 代码或属性窗口中的窗口图标属性,但 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>

【问题讨论】:

  • 都是 XAML 代码吗?结束的 标签在哪里?
  • @rufanov 抱歉我在这里错过了
  • 有什么异常?
  • @Ganesh XamlParseException
  • 是否有任何内部异常?

标签: c# wpf


【解决方案1】:

这是您的图像构建操作属性的问题,请查看箭头以获取更多信息..

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-28
    • 2018-08-05
    • 2022-10-23
    • 1970-01-01
    • 2021-07-23
    • 1970-01-01
    相关资源
    最近更新 更多