#困っていること
ページを持ったdllを参照して、ページを表示したいです。
呼び出し側のMainPage.xamlからボタンを押すと、呼ばれる側のBlankPage1.xamlに遷移させたいのですが、
C#
1private void Button_Click(object sender, RoutedEventArgs e) 2 { 3 this.Frame.Navigate(typeof(BlankPage1)); 4 }
Frame.Navigate(typeof(BlankPage1));
この箇所で
System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'
内部例外
XamlParseException: XAML parsing failed.
となります。
プロジェクトのクリーンやリビルドを試してみても変わらず解決策がわかりません。
どうぞよろしくお願いいたします。
以下、コードになります。
呼び出し側
MainPage.xaml.cs
C#
1namespace dlltest 2{ 3 /// <summary> 4 /// それ自体で使用できる空白ページまたはフレーム内に移動できる空白ページ。 5 /// </summary> 6 public sealed partial class MainPage : Page 7 { 8 public MainPage() 9 { 10 this.InitializeComponent(); 11 12 } 13 14 private void Button_Click(object sender, RoutedEventArgs e) 15 { 16 this.Frame.Navigate(typeof(dlluwptest.BlankPage1)); 17 } 18 } 19 20}
MainPage.xaml
xaml
1<Page 2 x:Class="dlltest.MainPage" 3 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 4 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 5 xmlns:local="using:dlltest" 6 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 7 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 8 mc:Ignorable="d" 9 Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 10 11 <Grid> 12 <Button Content="Button" Margin="104,116,0,0" VerticalAlignment="Top" Height="384" Width="499" Click="Button_Click"/> 13 14 </Grid> 15</Page>
呼ばれる側
BlankPage1.xaml.cs
C#
1namespace dlluwptest 2{ 3 /// <summary> 4 /// それ自体で使用できる空白ページまたはフレーム内に移動できる空白ページ。 5 /// </summary> 6 public sealed partial class BlankPage1 : Page 7 { 8 public BlankPage1() 9 { 10 this.InitializeComponent(); 11 } 12 13 private async void Button_Click(object sender, RoutedEventArgs e) 14 { 15 MessageDialog md = new MessageDialog("test"); 16 await md.ShowAsync(); 17 } 18 } 19}
BlankPage1.xaml
xaml
1<Page 2 x:Class="dlluwptest.BlankPage1" 3 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 4 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 5 xmlns:local="using:dlluwptest" 6 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 7 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 8 mc:Ignorable="d" 9 Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> 10 11 <Grid> 12 <Button Content="Button" Margin="60,52,0,0" VerticalAlignment="Top" Height="275" Width="290" Click="Button_Click"/> 13 14 </Grid> 15</Page>
あなたの回答
tips
プレビュー