Problem loading ImageSource in Unity
Posted: 29 Oct 2021, 19:25
HI , I am trying to bind an image source from a ViewModel
The URI code below, works in Blend but not in Unity were it throws the following error:
[NOESIS/E] Assets/GUI/XAML/MainWindow.xaml(1): Image not found '/NGTest8;component/Assets/Images/LoadingShot1.JPG'
I have basically taken the path from the 'Questlog' sample and slightly modified it. That works fine in Blend & unity for me, but mine doesn't.....
Am I missing something simple here?
namespace NGTest8
{
public partial class MainWindowViewModel : INotifyPropertyChanged
{
private readonly ImageSource image1 = new BitmapImage(new Uri("pack://application:,,,/NGTest8;component/Assets/Images/LoadingShot1.JPG"));
private readonly ImageSource image2 = new BitmapImage(new Uri("pack://application:,,,/NGTest8;component/Assets/Images/LoadingShot2.JPG"));
....
}
The URI code below, works in Blend but not in Unity were it throws the following error:
[NOESIS/E] Assets/GUI/XAML/MainWindow.xaml(1): Image not found '/NGTest8;component/Assets/Images/LoadingShot1.JPG'
I have basically taken the path from the 'Questlog' sample and slightly modified it. That works fine in Blend & unity for me, but mine doesn't.....
Am I missing something simple here?
namespace NGTest8
{
public partial class MainWindowViewModel : INotifyPropertyChanged
{
private readonly ImageSource image1 = new BitmapImage(new Uri("pack://application:,,,/NGTest8;component/Assets/Images/LoadingShot1.JPG"));
private readonly ImageSource image2 = new BitmapImage(new Uri("pack://application:,,,/NGTest8;component/Assets/Images/LoadingShot2.JPG"));
....
}