Export (0) Print
Expand All

SetSource Method (ImageBrush)

Sets the source value of an object with downloaded content.

XAML
Cannot use methods in XAML.
Scripting
object.SetSource(downloader, part)

Parameters

downloader

Downloader

The object containing 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 filename within downloader. If the downloaded content does not represent packaged content, set part to an empty string.

Remarks

The SetSource method sets the downloaded image content to the ImageSource property of the ImageBrush. Equivalent SetSource methods exist on Image (for Source) and MediaElement (for Source). The first parameter, downloader, identifies the Downloader object representing the downloaded content. The second parameter, part, identifies the specific part to retrieve within 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.

Examples

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

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

    // Set the ImageSource property to the contents of the downloaded object,
    // named gear_large.png as a zip part in the download
    myImageBrush.setSource(sender, "gear_large.png");
}

Applies To

ImageBrush

See Also

Using a Downloader Object
Downloader
SetSource Method (Image)
SetSource Method (MediaElement)

Community Additions

Show:
© 2014 Microsoft