NoesisGUI For C# Desktop Application Development
Posted: 25 Apr 2018, 15:43
I am having troubles assigning a png image to Image element in XAML. At runtime the application crashes with exception
1. App.xaml.cs
2. MainWindow.xaml
3. I added icon.png in project dir with build action "Resource" and added the same in Resources.resx file.
I ran the Menu3D sample from Github which loaded png images without any trouble. Can someone please point out what I might be doing wrong? I'd appreciate the help.
Thanks.
My steps are as follows:InvalidCastException: Unable to cast object of type 'System.Drawing.Bitmap' to type 'System.Byte[]'.
1. App.xaml.cs
Code: Select all
protected override TextureProvider GetTextureProvider()
{
EmbeddedTexture[] textures =
{
new EmbeddedTexture {filename="icon.png", resource="icon"}
};
return new EmbeddedTextureProvider(textures, Properties.Resources.ResourceManager);
}
Code: Select all
<Image Source="icon.png"/>I ran the Menu3D sample from Github which loaded png images without any trouble. Can someone please point out what I might be doing wrong? I'd appreciate the help.
Thanks.