Andrey Bushman
Andrey Bushman

Reputation: 12516

WPF: Load Window from XAML

How can I create Window instance from XAML file? In directory are located different XAML files (custom windows). I need load necessary XAML and show it. Is exists method as Window.LoadFromXAML?

Upvotes: 1

Views: 911

Answers (1)

Lubo
Lubo

Reputation: 754

You can do it with XamlReader.Load. It returns the root of the corresponding object tree. In your case the instance of Window class.

Upvotes: 2

Related Questions