WPF错误:无法识别或无法访问成员“资源”

问题描述:

好吧,我不得不说我刚开始使用WPF和我对XAML一无所知,因此对于我的第一个WPF项目,我会尝试建立自己的应用程序为我自己的业务,但即时通讯问题试图获得图像资源。WPF错误:无法识别或无法访问成员“资源”

这是我试过

<Window x:Class="MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="MainWindow" Height="605.027" Width="1042.214" WindowStyle="None" Background="{StaticResource Circuits}"> 
    <Application.resource>   
     <ImageBrush x:Key="Circuits" ImageSource="Circuits.jpg"/> 
    </Application.resource> 
</Window>` 

但在<Application.resource>行,我发现了错误

Do not recognize or can not access the member "resource"

,我只是不知道该怎么办

+0

在这里,你不应该加上“回答”对所有权,而不是你应该只标注由你已经做了绿色的勾答案。 – 2014-09-03 19:07:12

+0

好的。谢谢,我认为当其他人在寻找与这个问题有关的问题时回答这个问题会有所帮助,但是我不会在将来:D – 2014-09-03 20:29:05

<Window x:Class="MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="MainWindow" Height="605.027" Width="1042.214" WindowStyle="None" Background="{StaticResource Circuits}"> 
    <Window.Resources>   
     <ImageBrush x:Key="Circuits" ImageSource="Circuits.jpg"/> 
    </Window.Resources> 
</Window>` 
+0

您的提示工作,我刚刚添加“Imagenes \”的图像源和工作,例如: 2014-09-03 17:38:21

您是否尝试过:

<Application.Resources> 

因此,在您为例:

<Window x:Class="MainWindow" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Title="MainWindow" Height="605.027" Width="1042.214" WindowStyle="None" Background=" {StaticResource Circuits}"> 
<Application.Resources>   
    <ImageBrush x:Key="Circuits" ImageSource="Circuits.jpg"/> 
</Application.Resources> 
</Window> 
+0

yup,而且这是相同的 – 2014-09-03 17:28:26

+0

正是这样,保持不工作 – 2014-09-03 17:30:41