Reputation: 6967
To navigate to a specific page in the assembly, the typical code looks like:
NavigationService.Navigate(new Uri("pagename.xaml", UriKind.Relative));
I was wondering if there is a way to read the contents of this XAML file or may be a way to decompile the embedded BAML file from the assembly directly.
Upvotes: 2
Views: 1222
Reputation: 5226
To instantiate the control from your assembly you need to do the following:
Uri uri = new Uri( "/YourApplication;component/YourWindow.xaml",
UriKind.Relative );
Window window = (Window)Application.LoadComponent(uri);
where Window is the top element of this file. If you want the actual XAML you can use XamlWriter to give that to you:
String xaml = XamlWriter.Save( window );
Upvotes: 4