I'm trying to a Background image which is in my VS2010 project's Images folder. I have read the documentation and I tried several ways including following but can't get it to work:
ImageBrush bg2 = new ImageBrush();
bg2.ImageSource = new BitmapImage(new Uri(@"/FooApplication1;component/Images/bg1.png"));
ImageBrush bg1 = new ImageBrush();
bg1.ImageSource = new BitmapImage(new Uri(BaseUriHelper.GetBaseUri(this), "/FooApplication;component/Images/bg1.png"));
Anyone knows what's wrong?
I think the URI should look something like this:
"pack://application:,,,/Images/bg1.png"
Did you read this article on URIs?