I added a png file using Resource.resx, it is in a folder called resources. I am trying to change the background of my main window to an image.
this.Background = Properties.Resources.backGround;
gives cannot implicitly convert the type System.Drawing.Bitmap to System.Windows.Media.Brush
I tried to execute other answers that I found, for example
this.Background = new ImageBrush(new BitmapImage(new Uri(@"pack://application:,,,/myapp;component/Images/icon.png")));
but I honestly can't figure out how to use @ "pack ... etc." I tried something like this
@"pack://Info Collector:,,,/myapp;component/resources/backGround.png")));
but again I cannot find good resources that explain the line.
Thank you for the advanced.
source
share