Resource.resx に埋め込んだ画像を Image に表示したくて、
ネットで調べてようやく見つけた方法がこちら。
// ここでは ResourceManager を使って画像を取得
Bitmap bitmap = (Bitmap)Properties.Resources.ResourceManager.GetObject("sample");
// 自動で生成されたプロパティを使っても良い
// Bitmap bitmap = Properties.Resources.sample;
// 元の画像ファイルは PNG だったので、メモリに PNG で書き込む
MemoryStream stream = new MemoryStream();
bitmap.Save(stream, ImageFormat.Png);
// BitmapDecoder を介して ImageSource を取得する
BitmapDecoder decoder = new PngBitmapDecoder(stream, BitmapCreateOptions.None, BitmapCacheOption.Default);
ImageSource source = decoder.Frames[0];
// 作成した ImageSource を Image にセットする
Image image = new Image();
image.Source = source;
これは結構面倒。もっと楽に表示できないのかなぁ。