XamlReader.Load メソッド

定義

XAML 入力を読み取り、対応するオブジェクト ツリーのルートを返します。

オーバーロード

名前 説明
Load(Stream)

指定した Stream の XAML 入力を読み取り、対応するオブジェクト ツリーのルートである Object を返します。

Load(XamlReader)

指定された XamlReader を介して XAML 入力を読み取り、対応するオブジェクト ツリーのルートであるオブジェクトを返します。

Load(XmlReader)

指定した XmlReader の XAML 入力を読み取り、対応するオブジェクト ツリーのルートであるオブジェクトを返します。

Load(Stream, Boolean)
Load(Stream, ParserContext)

指定した Stream の XAML 入力を読み取り、対応するオブジェクト ツリーのルートであるオブジェクトを返します。

Load(XmlReader, Boolean)
Load(Stream, ParserContext, Boolean)

Load(Stream)

指定した Stream の XAML 入力を読み取り、対応するオブジェクト ツリーのルートである Object を返します。

public:
 static System::Object ^ Load(System::IO::Stream ^ stream);
public static object Load(System.IO.Stream stream);
static member Load : System.IO.Stream -> obj
Public Shared Function Load (stream As Stream) As Object

パラメーター

stream
Stream

ストリーム形式で読み込む XAML。

返品

作成されたオブジェクト ツリーのルートにあるオブジェクト。

例外

streamnullです。

次の例では、Button クラスを使用してMemoryStreamXamlWriterに保存します。 その後、Button クラスの静的Load メソッドを使用して、ストリームがXamlReaderに読み込まれます。

// Create the Button.
Button originalButton = new Button();
originalButton.Height = 50;
originalButton.Width = 100;
originalButton.Background = Brushes.AliceBlue;
originalButton.Content = "Click Me";

// Save the Button to a string.
string savedButton = XamlWriter.Save(originalButton);

// Load the button
StringReader stringReader = new StringReader(savedButton);
XmlReader xmlReader = XmlReader.Create(stringReader);
Button readerLoadButton = (Button)XamlReader.Load(xmlReader);
' Create the Button.
Dim originalButton As New Button()
originalButton.Height = 50
originalButton.Width = 100
originalButton.Background = Brushes.AliceBlue
originalButton.Content = "Click Me"

' Save the Button to a string.
Dim savedButton As String = XamlWriter.Save(originalButton)

' Load the button
Dim stringReader As New StringReader(savedButton)
Dim xmlReader As XmlReader = XmlReader.Create(stringReader)
Dim readerLoadButton As Button = CType(XamlReader.Load(xmlReader), Button)

こちらもご覧ください

適用対象

Load(XamlReader)

指定された XamlReader を介して XAML 入力を読み取り、対応するオブジェクト ツリーのルートであるオブジェクトを返します。

public:
 static System::Object ^ Load(System::Xaml::XamlReader ^ reader);
public static object Load(System.Xaml.XamlReader reader);
static member Load : System.Xaml.XamlReader -> obj
Public Shared Function Load (reader As XamlReader) As Object

パラメーター

reader
XamlReader

XamlReader オブジェクト。 これは、入力 XAML で初期化されることが想定されています。

返品

作成されたオブジェクト ツリーのルートであるオブジェクト。

例外

readernullです。

注釈

入力 XamlReaderBaml2006Readerできます。 これは、実行時またはローカライズ ツールの目的で BAML を読み込む方法です。

適用対象

Load(XmlReader)

指定した XmlReader の XAML 入力を読み取り、対応するオブジェクト ツリーのルートであるオブジェクトを返します。

public:
 static System::Object ^ Load(System::Xml::XmlReader ^ reader);
public static object Load(System.Xml.XmlReader reader);
static member Load : System.Xml.XmlReader -> obj
Public Shared Function Load (reader As XmlReader) As Object

パラメーター

reader
XmlReader

XML 形式で読み込む XAML 入力が既に読み込まれている XmlReader

返品

作成されたオブジェクト ツリーのルートであるオブジェクト。

例外

readernullです。

次の例では、Button クラスを使用してXamlWriterを文字列に変換します。 その後、Button クラスの静的Load メソッドを使用して、文字列がXamlReaderに読み込まれます。

// Create the Button.
Button originalButton = new Button();
originalButton.Height = 50;
originalButton.Width = 100;
originalButton.Background = Brushes.AliceBlue;
originalButton.Content = "Click Me";

// Save the Button to a string.
string savedButton = XamlWriter.Save(originalButton);

// Load the button
StringReader stringReader = new StringReader(savedButton);
XmlReader xmlReader = XmlReader.Create(stringReader);
Button readerLoadButton = (Button)XamlReader.Load(xmlReader);
' Create the Button.
Dim originalButton As New Button()
originalButton.Height = 50
originalButton.Width = 100
originalButton.Background = Brushes.AliceBlue
originalButton.Content = "Click Me"

' Save the Button to a string.
Dim savedButton As String = XamlWriter.Save(originalButton)

' Load the button
Dim stringReader As New StringReader(savedButton)
Dim xmlReader As XmlReader = XmlReader.Create(stringReader)
Dim readerLoadButton As Button = CType(XamlReader.Load(xmlReader), Button)

こちらもご覧ください

適用対象

Load(Stream, Boolean)

public:
 static System::Object ^ Load(System::IO::Stream ^ stream, bool useRestrictiveXamlReader);
public static object Load(System.IO.Stream stream, bool useRestrictiveXamlReader);
static member Load : System.IO.Stream * bool -> obj
Public Shared Function Load (stream As Stream, useRestrictiveXamlReader As Boolean) As Object

パラメーター

stream
Stream
useRestrictiveXamlReader
Boolean

返品

適用対象

Load(Stream, ParserContext)

指定した Stream の XAML 入力を読み取り、対応するオブジェクト ツリーのルートであるオブジェクトを返します。

public:
 static System::Object ^ Load(System::IO::Stream ^ stream, System::Windows::Markup::ParserContext ^ parserContext);
public static object Load(System.IO.Stream stream, System.Windows.Markup.ParserContext parserContext);
static member Load : System.IO.Stream * System.Windows.Markup.ParserContext -> obj
Public Shared Function Load (stream As Stream, parserContext As ParserContext) As Object

パラメーター

stream
Stream

読み込む XAML 入力を含むストリーム。

parserContext
ParserContext

パーサーによって使用されるコンテキスト情報。

返品

作成されたオブジェクト ツリーのルートであるオブジェクト。

例外

streamnullです。

-又は-

parserContextnullです。

こちらもご覧ください

適用対象

Load(XmlReader, Boolean)

public:
 static System::Object ^ Load(System::Xml::XmlReader ^ reader, bool useRestrictiveXamlReader);
public static object Load(System.Xml.XmlReader reader, bool useRestrictiveXamlReader);
static member Load : System.Xml.XmlReader * bool -> obj
Public Shared Function Load (reader As XmlReader, useRestrictiveXamlReader As Boolean) As Object

パラメーター

reader
XmlReader
useRestrictiveXamlReader
Boolean

返品

適用対象

Load(Stream, ParserContext, Boolean)

public:
 static System::Object ^ Load(System::IO::Stream ^ stream, System::Windows::Markup::ParserContext ^ parserContext, bool useRestrictiveXamlReader);
public static object Load(System.IO.Stream stream, System.Windows.Markup.ParserContext parserContext, bool useRestrictiveXamlReader);
static member Load : System.IO.Stream * System.Windows.Markup.ParserContext * bool -> obj
Public Shared Function Load (stream As Stream, parserContext As ParserContext, useRestrictiveXamlReader As Boolean) As Object

パラメーター

stream
Stream
parserContext
ParserContext
useRestrictiveXamlReader
Boolean

返品

適用対象