XAML

<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button Name="b1" Width="100" Height="20" Click="b1_Click"></Button>
<Button Name="b2" Width="100" Height="20" Margin="0,50,0,0" Click="b2_Click"></Button>
<Frame Name="f1" NavigationUIVisibility="Hidden" />
</Grid>
</Window>
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Frame Name="f1" NavigationUIVisibility="Hidden">
<Frame.Content>
<Grid>
<Button Name="b1" Width="100" Height="20" Click="b1_Click"></Button>
<Button Name="b2" Width="100" Height="20" Margin="0,50,0,0" Click="b2_Click"></Button>
</Grid>
</Frame.Content>
</Frame>
</Grid>
</Window>

CS

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes; namespace WpfApplication1
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
Page1 p1;
Page2 p2;
public MainWindow()
{
InitializeComponent();
p1 = new Page1();
p2 = new Page2();
} private void b1_Click(object sender, RoutedEventArgs e)
{
//f1.Source = new Uri("Page1.xaml", UriKind.Relative);
f1.Content = p1;
} private void b2_Click(object sender, RoutedEventArgs e)
{
//f1.Source = new Uri("Page2.xaml", UriKind.Relative);
f1.Content = p2;
}
}
}

WPF页面切换的更多相关文章

  1. WPF页面切换及弹窗

    WPF页面切换及弹窗 结构如图: 效果如图: 代码如下: xaml <Window x:Class="PageChange.MainWindow" xmlns="h ...

  2. WPF 页面切换效果

    原文:WPF 页面切换效果 最近做一个有页面切换的吧.. 我觉得这个功能是比较基础的吧.. 在网上百度了一下.. 用NavigationWindow的比较好.. 因为Demo中是带了淡入淡出的页面效果 ...

  3. WPF中窗体在同一个位置实现不同页面切换

    要想在WPF窗体中实现不同页面切换,我们就需要用到ContentControl这个控件,这个控件的位置和大小就是你要显示页面的位置和大小. 下面举例说明: Xaml: <Grid> < ...

  4. 快速构建H5单页面切换骨架

    在Web App和Hybrid App横行的时代,为了拥有更好的用户体验,单页面应用顺势而生,单页面应用简称`SPA`,即Single Page Application,就是只有一个HTML页面的应用 ...

  5. Android中使用ViewPager实现屏幕页面切换和页面切换效果

    之前关于如何实现屏幕页面切换,写过一篇博文<Android中使用ViewFlipper实现屏幕切换>,相比ViewFlipper,ViewPager更适用复杂的视图切换,而且Viewpag ...

  6. ViewPager之Fragment页面切换

    一.概述 ViewPager是android-support-v4中提供的类,它是一个容器类,常用于页面之间的切换. 继上篇文章<ViewPager之引导页>之后,本文主要介绍ViewPa ...

  7. html tab页面切换事件。

    $(document).bind("visibilitychange",function(e){ //只对tab页面切换有效 //document.visibilityState ...

  8. vue-lazy-render: 延迟渲染大组件,增强页面切换流畅度

    最近用element来做项目,在开发的过程中,突然发现页面的操作和切换在数据量大的时候相当卡,后来提了个issue,在furybean解答后才知道,我每个单元格都加了tooltip,会生成大量的节点, ...

  9. 第54课 Qt 中的多页面切换组件

    1. 多页面切换组件(QTabWidget) (1)能够在同一个窗口中自由切换不同页面的内容 (2)是一个容器类型的组件,同时提供友好的页面切换方式 2. QTabWidget的使用方式 (1)在应用 ...

随机推荐

  1. python报错bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml.

    qpython运行 原代码:    soup = BeautifulSoup(r.text,'lxml') 报错:bs4.FeatureNotFound: Couldn't find a tree b ...

  2. springboot web - 启动(4) tomcat

    接第二篇 第二篇里面, 看到容器创建的是 AnnotationConfigServletWebServerApplicationContext 类型. 一 .类图 二. 构造 public Gener ...

  3. redis中获取每个数据类型top-n的bigkeys信息

    需求:之前写的脚本获取redis 最大的top-n的bigkeys,没有区分数据类型,如果要针对每个数据类型的前top-n的bigkeys获取呢? db_ip=5.5.5.101 db_port= p ...

  4. CF718C Sasha and Array [线段树+矩阵]

    我们考虑线性代数上面的矩阵知识 啊呸,是基础数学 斐波那契的矩阵就不讲了 定义矩阵 \(f_x\) 是第 \(x\) 项的斐波那契矩阵 因为 \(f_i * f_j = f_{i+j}\) 然后又因为 ...

  5. Gerrit评审代码流程注意事项

    Gerrit管理CR流程时要注意下面两大事项: (一)格式规范 这部分主要是根据公司或者团队的要求规范来撰写格式,这里不做统一介绍了:格式规范的宗旨是让修改的代码和业务需求能够匹配.可追溯. (二)评 ...

  6. html5的页面在IOS中,按钮 变成圆角怎么办?

      在button的css 中添加: -webkit-appearance: none;     border: none;     border-radius: 0; ok 的啦   文章来源:刘俊 ...

  7. IntelliJ Pycharm 2019年最新版 安装激活教程【最强,可用至2089、2100年】

    本文为2019年Pycharm最新版安装永久激活教程 PyCharm 2019.3 (Professional Edition) ①IntelliJ Pycharm 2019.3安装永久破解[最强] ...

  8. java中堆栈的一些理解备忘

    堆:用来存放对象的信息,同一个类存放各自的成员变量,共享对象的方法. 栈:用来保存局部变量的值,包括基本数据类型的值.保存类的实例(堆区对象的引用).保存加载方法的帧. 常量池:包含了一个类型所有的对 ...

  9. CodeForces 1144C

    链接 https://vjudge.net/problem/CodeForces-1144C #include<bits/stdc++.h> using namespace std; in ...

  10. Struts2学习-jsp中超链接传参问题

    今天在学习过程中对struts2中超链接的传参问题产生了一些疑惑,不明白jsp中的超链接如何将参数传到Action方法中去的. <s:iterator value="categorys ...