Reputation: 41638
How do I get a System.Windows.Controls.Image to use an image of a specified resolution and color depth from a .ico resource?
Upvotes: 3
Views: 1074
Reputation: 41638
Create a BitmapFrame and use its Decoder. For example, to access a 48x48, 32-bit image:
BitmapFrame icon = BitmapFrame.Create(new Uri("pack://application:,,,/Resources/Icon.ico", UriKind.Absolute));
BitmapFrame image = icon.Decoder.Frames.First(f => f.PixelHeight == 48 && f.Format.BitsPerPixel == 32);
Upvotes: 4