Skip to content

ImageHelper

Rico Suter edited this page Jul 8, 2015 · 4 revisions
  • Package: MyToolkit.Extended
  • Platforms: WP7SL, WP8SL, WinRT, UWP

This class can be used for better image loading performance or to load images with username-password authentication (by using an AuthenticatedUri object).

<Image Media:ImageHelper.Source="http://myurl" />

It is also possible to stop the image loading for example while scrolling a list in the MtListBox.

The OnScrollingStateChanged from the MtListBox class:

protected void OnScrollingStateChanged(object sender, 
    ScrollingStateChangedEventArgs e)
{
	ImageHelper.IsEnabled = # e.NewValue;
}

Don't forget to reenable the image loading in OnNavigatingFrom (Windows Phone) because the stop scrolling event may never occur.

The ImageHelper also supports AuthenticatedUris (Uris with credentials).

Tip: This class can also be used to display images with hotlink protection. See this StackOverflow question.

Clone this wiki locally