Control.InitializeFromXaml Method

[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]

Returns an element that is created by parsing the provided XAML, and sets that element to be the child of this control.

Namespace:  System.Windows.Controls
Assembly:  System.Windows (in System.Windows.dll)

'Declaration
Protected Function InitializeFromXaml ( _
	xaml As String _
) As FrameworkElement
'Usage
Dim xaml As String
Dim returnValue As FrameworkElement

returnValue = Me.InitializeFromXaml(xaml)

Parameters

xaml
Type: System.String

The input XAML, given as a string.

Return Value

Type: System.Windows.FrameworkElement

The object that is created and becomes the single child (implementation root) of this control.

You would typically use the return value of InitializeFromXaml to retain an instance value on which you would set any instance properties that the control class defines.

Although the xaml parameter type is String, you would seldom want to provide a literal string to fill this value. Instead, you might obtain this XAML content by loading a resource, either a Silverlight-specific resource, or a resource in the sense of an assembly part if you are defining a control's code and its visual appearance as component parts of an assembly. You might use other types such as Stream or StreamReader as intermediaries to load assembly resources.

If the root of the XAML parsing is not a FrameworkElement or subclass, InitializeFromXaml will throw an exception.

Show: