Bind Image Source to web address is not problem, it will works well... until You don't care about performance. Problem will appear if You want to cache images. Isolated storage is only way to store downloaded files in Silverlight not matter Browser or Windows Phone. Not so difficult to download image file from Internet and save to Isolated Storage, but how to use it in Silverlight Page?
Well, lets try to figure out. First define image converter:
- public class IsoImageConverter : IValueConverter
- {
- //Convert Data to Image when Loading Data
- public object Convert(object value, Type targetType, object parameter,
- System.Globalization.CultureInfo culture)
- {
- var bitmap = new BitmapImage();
- try
- {
- var path = (string)value;
- if (!String.IsNullOrEmpty(path))
- {
- using (var file = LoadFile(path))
- {
- bitmap.SetSource(file);
- }
- }
- }
- catch
- {
- }
- return bitmap;
- }
- private Stream LoadFile(string file)
- {
- using (var isoStore = IsolatedStorageFile.GetUserStoreForApplication())
- {
- return isoStore.OpenFile(file, FileMode.Open, FileAccess.Read);
- }
- }
- public object ConvertBack(object value, Type targetType, object parameter,
- System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
Next define link in App.xaml for use in XAML code
- <local:IsoImageConverter x:Key="IsoImageCoverter"/>
And finally bind to string path to Isolated Storage image file
- <Image Source="{Binding ImagePath, Converter={StaticResource IsoImageCoverter}}"/>
Work Fine!(* ̄∇ ̄*)
ReplyDeleteThanks
Now days Business Phone Service come packed with a lot of features. You can basically customize your business phone service to fit your business needs. When you see the features, you will know how your current phone system is not good enough. I have been using hosted pbx from Telcan. With this business phone service, I can customize the welcome greeting, route calls to multiple numbers, even program what phone number to call at what time, have a professional voicemail, get my voicemail emailed and the list goes on. It is very easy to set up using wizard. Check out Business Phone Service
ReplyDeleteI have a list of images. How can i use this with it
ReplyDeleteGreat Article
ReplyDeleteImage Processing Projects
Deep Learning Projects for Final Year
JavaScript Training in Chennai
JavaScript Training in Chennai
The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training Project Centers in Chennai
You have provided valuable data for us. It is great and informative for everyone. Keep posting always. I am very thankful to you. vector image software mac
ReplyDelete