Reputation: 81
Ok, I have to say that I just started using WPF and I know nothing about XAML, so for my first project with WPF, I'll be trying to build my own app for my own buisness, But im getting a problem trying to get an image resource.
This is what I tried
<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>`
But at the <Application.resource>
line I'm getting the error
Do not recognize or can not access the member "resource"
and I just dont know what to do
Upvotes: 1
Views: 5281
Reputation: 5135
<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>`
Upvotes: 2
Reputation: 13313
Have you tried :
<Application.Resources>
So in your exemple :
<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>
Upvotes: 0