I am new to C# programming so please have some mercy. I use Visual Studio Community 2019. I am in the process of creating a WPF App (so an .exe file can be created). Within the designer I have placed a number of buttons with images (see code below). I want to change that image in the code with "button.Image" as I have read in several solutions, but I get an error
(CS0246 The type or namespace name 'button_1_PL' could not be found (are you missing a using directive or an assembly reference?)).
As most solutions I have read are using VS 2013, I have tried installing that also, but to no avail (same errors). I have added "using System.Drawing;" to the header part of the code, but still get the same error. When I try to add "using System.Drawing.Image;" or "using System.Drawing.Imaging;" I get an error (CS0234 The type or namespace name 'Imaging' does not exist in the namespace 'System.Drawing' (are you missing an assembly reference?)).
The header part of c#:
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Resources;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
The header part of the designer:
<Window x:Class="mJingles.MainWindow"
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"
xmlns:local="clr-namespace:mJingles"
mc:Ignorable="d"
Title="mJingles - All your songs and jingles at your fingertips..." Height="1015" Width="1920">
<Grid>
<Button Name="button_1_PL" HorizontalAlignment="Left" Margin="98,85,0,0" VerticalAlignment="Top" Width="124" BorderThickness="0" Click="Button_1_PL_Click">
<Image Source="Images\SelectPL.png"></Image>
</Button>
I want to be able to change the background image of a button, but with all the examples I have found I still get the errors as described above. I am sure I must be missing something (in both senses of the word) but I don't know what.