Export (0) Print
Expand All

SetSource (ImageBrush)

Silverlight

Sets the source value of an ImageBrush object with downloaded content.

object.SetSource(downloader, part)

downloader

Downloader

The Downloader object that contains the downloaded content.

part

string

The name of the specific part of the downloaded content package. When the downloaded content package is a .zip file, part refers to the contents of a file name in downloader. If the downloaded content does not represent packaged content, set part to an empty string.

SetSource - use a stream obtained from WebClient as input.

The SetSource method sets the downloaded image content to the ImageSource property of an ImageBrush object. Equivalent SetSource methods exist on Image (for Source) and MediaElement (for Source). The first parameter, downloader, identifies the Downloader object that represents the downloaded content. The second parameter, part, identifies the specific part to retrieve from the downloaded content. If the downloaded content does not represent packaged content, such as a .zip file, part must be set to an empty string.

The following JavaScript example shows how to use the SetSource method to set the Source property of an ImageBrush object to the downloaded content.

// Event handler for the Completed event.
function onCompletedImageBrush(sender, eventArgs)
{
    // Retrieve the ImageBrush object.
    var myImageBrush = sender.findName("myImageBrush");

    // Set the ImageSource property from the gear_large.png part of a larger .zip download.
    myImageBrush.setSource(sender, "gear_large.png");
}

Community Additions

ADD
Show:
© 2014 Microsoft