2011-03-02 3 views
0

私のVS2010プロジェクトのImagesフォルダにある背景イメージにしようとしています。私は、ドキュメントを読んでいると私は、次のようないくつかの方法を試してみましたが、それは仕事を得ることはできません。BitmapImageでコードビハインドでImageSourceパスを設定する方法

 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")); 

誰もが間違って何を知っていますか?

答えて

0

私は、URIはこのようなものになるはずだと思う:

"pack://application:,,,/Images/bg1.png" 

あなたがthis article on URIsを読みましたか?

関連する問題