Gets or sets the image displayed by this ImageBrush.
Assembly: System.Windows (in System.Windows.dll)
XMLNS for XAML: Not mapped to an xmlns.
Dependency property identifier field: ImageSourceProperty
The XAML usage for is significantly different than the code usage. The XAML usage uses a URI whereas the code usage uses an ImageSource. See "Setting ImageSource in XAML" section of this topic.
In the code usage, the equivalent ImageSource property can be set by a string that is evaluated as a URI. This property uses an underlying ImageSource instance (actually this is usually a BitmapImage, which is a derived class).
Setting ImageSource in XAML
You can set this property in XAML, but in this case you are setting the property as a URI. This behavior relies on underlying type conversion that processes the string as a URI, and calls the BitmapImage(Uri) constructor. This in turn potentially requests a stream from that URI and returns the image source object.
The string provided for the property is interpreted as a Uniform Resource Identifier (URI). This is in contrast to an Internationalized Resource Identifier (IRI). This distinction means that characters used to identify a that are outside of US-ASCII will need to be encoded.
The format-specific filename extensions for the supported image formats are not required to be in the URI naming. However, if the retrieved file is a valid image format when it is opened or processed, a runtime exception is thrown.
The ImageFailed event can occur if the initial attribute value in XAML does not specify a valid source.
You can use a relative URI to reference an image that you package with the application, or an absolute URI to reference an image from a server.
You can specify an initial XAML value of "" (empty string) and then set the value in script at a later time, to create a nonrendering placeholder.