WPF - 尝试向我的窗口添加一个图标,但收到一个奇怪的错误

时间:2013-10-04 22:59:35

标签: c# wpf

发生了XamlParseException 提供'System.Windows.BAML.2006.TypeConverterMarkupExtension'上的值引发异常

我查找了如何添加图标的示例,看起来很简单。我该如何解决这个问题?

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="DTV_Red_Zone_Channel.MainWindow"
        Title="DirecTV Red Zone Channel" WindowStartupLocation="CenterScreen" WindowStyle="None" ResizeMode="NoResize"
        Initialized="WindowInitialized" SizeToContent="WidthAndHeight"
        Icon="RCS_Generic.ico">  <---- Where it's Erroring

1 个答案:

答案 0 :(得分:2)

  

啊......它说它无法找到资源'rcs_generic.ico'但是我把它放在主目录和可执行文件夹所在的位置......那么我会把它放在哪里呢?

您需要在项目中包含RSC_Generic.ico(在根目录,包括您的XAML),确保将其属性设置为使用Build Action Resource

相关问题