Show不是';WpfApplication1.Page2';

Show不是';WpfApplication1.Page2';,wpf,vb.net,Wpf,Vb.net,我只想在WPF页面之间切换,但出现上述错误: “Show不是WpfApplication1.Page2的成员”。 这是我的密码 Imports System.Windows.Forms Public Class Page1 ' Private Property Page2 As WpfApplication1.Page2 Private Sub btn1_Click(sender As Object, e As RoutedEventArgs) Handles btn1.Click

我只想在
WPF
页面之间切换,但出现上述错误: “Show不是WpfApplication1.Page2的成员”。 这是我的密码

Imports System.Windows.Forms


Public Class Page1

'  Private Property Page2 As WpfApplication1.Page2

Private Sub btn1_Click(sender As Object, e As RoutedEventArgs) Handles btn1.Click


    Dim dd As New Page2
    dd.Show(Me)
    'dd.ShowDialog(Me)

    Me.txt1.Text = (dd.txt10.Text)
End Sub
End Class
第2页xaml代码

<Page x:Class="Page2"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
  mc:Ignorable="d" 
  d:DesignHeight="300" d:DesignWidth="300"
  Title="Page2">
<Grid>

    <Button x:Name="button1" Content="Button" HorizontalAlignment="Left" Margin="163,62,0,0" VerticalAlignment="Top" Width="101" Height="55"/>
    <TextBox x:Name="txt10" HorizontalAlignment="Left" Height="23" Margin="38,81,0,0" TextWrapping="Wrap" Text="TextBox" VerticalAlignment="Top" Width="120"/>

</Grid>
班级第2页

末级

请告诉我我做错了什么。

将dd作为新的第2页


Me.Content=dd

PresentationFramework.dll中发生“System.InvalidOperationException”类型的未经处理的异常。请知道发生此错误{“页面只能将窗口或框架作为父级。”}详细信息显示此消息这不是完整的答案;你不能解释这是怎么回事。请在你的回答中描述这是什么。这对我或用户来说是什么?2435645这不是一个完整的答案;你不能解释这是怎么回事。请在您的回答中说明这是什么作用436f6465786572 4分钟ago@SoniaRehman我告诉他,他需要更新他的答案,解释它的作用以及如何解决您的问题。仅仅看他建议的答案对任何人都没有帮助。这意味着你的
Page2
不是一个(有效的)窗口。请发布
XAML
的第一行和后面的代码。您需要确保您是从
窗口继承的
…您的问题是因为它在
XAML
代码中。您需要在
Page2
中的代码隐藏中使用
Window
您需要继承
Window
谁继承Window请在这方面指导我,我将非常感谢您
Imports System.Windows.Forms