Application.LoadComponent Application.LoadComponent Application.LoadComponent Application.LoadComponent Method

Definition

Loads a XAML file that is located at the specified uniform resource identifier (URI).

Overloads

LoadComponent(Uri) LoadComponent(Uri) LoadComponent(Uri) LoadComponent(Uri)

Loads a XAML file that is located at the specified uniform resource identifier (URI), and converts it to an instance of the object that is specified by the root element of the XAML file.

LoadComponent(Object, Uri) LoadComponent(Object, Uri) LoadComponent(Object, Uri) LoadComponent(Object, Uri)

Loads a XAML file that is located at the specified uniform resource identifier (URI) and converts it to an instance of the object that is specified by the root element of the XAML file.

Remarks

The XAML file can be an application code file (configured as an Microsoft build engine (MSBuild) Page item) or an application data file (a resource file, content file, or site-of-origin file; see WPF Application Resource, Content, and Data Files).

Note

This method is not thread-safe.

LoadComponent(Uri) LoadComponent(Uri) LoadComponent(Uri) LoadComponent(Uri)

Loads a XAML file that is located at the specified uniform resource identifier (URI), and converts it to an instance of the object that is specified by the root element of the XAML file.

public:
 static System::Object ^ LoadComponent(Uri ^ resourceLocator);
public static object LoadComponent (Uri resourceLocator);
static member LoadComponent : Uri -> obj
Public Shared Function LoadComponent (resourceLocator As Uri) As Object

Parameters

resourceLocator
Uri Uri Uri Uri

A Uri that maps to a relative XAML file.

Returns

An instance of the root element specified by the XAML file loaded.

Exceptions

The file is not a XAML file.

Remarks

You must explicitly convert the return value to the same type as the root element of the XAML file.

The XAML file can be an application code file (configured as an Microsoft build engine (MSBuild) Page item) or an application data file (a resource file, content file, or site-of-origin file; see WPF Application Resource, Content, and Data Files).

Note

This method is not thread-safe.

See also

LoadComponent(Object, Uri) LoadComponent(Object, Uri) LoadComponent(Object, Uri) LoadComponent(Object, Uri)

Loads a XAML file that is located at the specified uniform resource identifier (URI) and converts it to an instance of the object that is specified by the root element of the XAML file.

public:
 static void LoadComponent(System::Object ^ component, Uri ^ resourceLocator);
[System.Security.SecurityCritical]
public static void LoadComponent (object component, Uri resourceLocator);
static member LoadComponent : obj * Uri -> unit
Public Shared Sub LoadComponent (component As Object, resourceLocator As Uri)

Parameters

component
Object Object Object Object

An object of the same type as the root element of the XAML file.

resourceLocator
Uri Uri Uri Uri

A Uri that maps to a relative XAML file.

Exceptions

component is of a type that does not match the root element of the XAML file.

Remarks

The XAML file can be an application code file (configured as an Microsoft build engine (MSBuild) Page item) or an application data file (a resource file, content file, or site-of-origin file; see WPF Application Resource, Content, and Data Files).

Note

This method is not thread-safe.

See also

Applies to