在WPF中,可以通过以下几种方式实现多个XAML界面的切换:
<Window>
<Grid>
<Frame x:Name="ContentFrame" />
</Grid>
</Window>
private void Button_Click(object sender, RoutedEventArgs e)
{
ContentFrame.Navigate(new Uri("Page1.xaml", UriKind.Relative));
}
<Window>
<Grid>
<ContentControl x:Name="Content" />
</Grid>
</Window>
private void Button_Click(object sender, RoutedEventArgs e)
{
Content.Content = new Page1();
}
以上是几种常见的实现多个XAML界面切换的方式,根据具体需求和项目架构选择合适的方式。
辰迅云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>