I need to set image source dynamically, please note my image is in somewhere on the Network, here is my code
BitmapImage logo = new BitmapImage(); logo.BeginInit(); logo.UriSource = new Uri(@"pack://application:,,,\myserver\folder1\Customer Data\sample.png"); logo.EndInit(); // Getting the exception here ImageViewer1.Source = logo;
Exception:
The URI prefix is not recognized
You just need one line:
ImageViewer1.Source = new BitmapImage(new Uri(@"myserverfolder1Customer Datasample.png"));
2.1m questions
2.1m answers
60 comments
57.0k users