简体   繁体   English

System.Windows.Baml2006.TypeConverterMarkupExtension'抛出异常。' 行号'6'和行位置'10

[英]System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '6' and line position '10

I have add an Image resource for the wpf project am making by: 我为wpf项目添加了一个Image资源:

right-click on the Project -> Properties -> Resources -> Images -> From Existing -> ClientBackGround.png

and I made it background for the main window : 我把它作为主窗口的背景:

<Window x:Class="Illuminate_AutoPatcher.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Width="1000" Height="750" ResizeMode="NoResize" WindowStyle="None" WindowStartupLocation="CenterScreen">
    <Window.Background>
        <ImageBrush ImageSource="pack://siteoforigin:,,,/Resources/ClientBackground.png"/>
    </Window.Background>
    <Grid>
        <Button Content="" HorizontalAlignment="Left" VerticalAlignment="Top" Width="224" Margin="766,613,0,0" Height="124" >
        </Button>
    </Grid>
</Window>

but it's not working it's keep throwing this anoying error System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '6' and line position '10 但它没有工作它继续抛出这个恼人的错误System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '6' and line position '10 System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '6' and line position '10 , how I supposed to fix it, so I use static resources that's build with the project? System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '6' and line position '10 ,我应该如何解决它,所以我使用与项目一起构建的静态资源?

@HighCore is right, using application solves your issue in the given scenario @HighCore是对的,使用应用程序解决了给定方案中的问题

    <ImageBrush ImageSource="pack://application:,,,/Resources/ClientBackground.png"/>

You still can use siteoforigin . 你仍然可以使用siteoforigin For that you have to set the image property 为此,您必须设置图像属性

Copy to Output Directory to " Copy always " 复制到输出目录为“ 始终复制

MSDN Link MSDN链接

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 &#39;为&#39;System.Windows.Baml2006.TypeConverterMarkupExtension&#39;提供价值,引发了一个异常。 行号&#39;49&#39;和行位置&#39;38&#39; - 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' Line number '49' and line position '38' '在 'System.Windows.Baml2006.TypeConverterMarkupExtension' 上提供值引发异常。 - 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception.' 在“ System.Windows.Baml2006.TypeConverterMarkupExtension”上提供值引发异常 - Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' threw an exception System.Windows.Baml2006.TypeConverterMarkupExtension - System.Windows.Baml2006.TypeConverterMarkupExtension 如何解决此错误:“在&#39;System.Windows.Baml2006.TypeConverterMarkupExtension&#39;上提供值” - How do I fix this error : 'Provide value on 'System.Windows.Baml2006.TypeConverterMarkupExtension' 使用触发器更改图像获取System.Windows.Baml2006.TypeConverterMarkupExtension错误 - Change an image using triggers getting System.Windows.Baml2006.TypeConverterMarkupExtension error 错误System.Windows.Baml2006.TypeConverterMerkupExtension。 会是什么呢? - error System.Windows.Baml2006.TypeConverterMerkupExtension. What could it be? "Xaml 异常:“在 &#39;System.Windows.Markup.StaticResourceHolder&#39; 上提供值引发异常。”" - Xaml exception: "Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an exception." WPF&#39;设置属性&#39;System.Windows.ResourceDictionary.DeferrableContent&#39;引发了一个异常。 - WPF 'Set property 'System.Windows.ResourceDictionary.DeferrableContent' threw an exception.' WPF 应用程序错误“设置属性“System.Windows.ResourceDictionary.Source”引发异常。 - WPF application error 'Set property 'System.Windows.ResourceDictionary.Source' threw an exception.'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM