WPF页面切换
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页面切换的更多相关文章
- WPF页面切换及弹窗
WPF页面切换及弹窗 结构如图: 效果如图: 代码如下: xaml <Window x:Class="PageChange.MainWindow" xmlns="h ...
- WPF 页面切换效果
原文:WPF 页面切换效果 最近做一个有页面切换的吧.. 我觉得这个功能是比较基础的吧.. 在网上百度了一下.. 用NavigationWindow的比较好.. 因为Demo中是带了淡入淡出的页面效果 ...
- WPF中窗体在同一个位置实现不同页面切换
要想在WPF窗体中实现不同页面切换,我们就需要用到ContentControl这个控件,这个控件的位置和大小就是你要显示页面的位置和大小. 下面举例说明: Xaml: <Grid> < ...
- 快速构建H5单页面切换骨架
在Web App和Hybrid App横行的时代,为了拥有更好的用户体验,单页面应用顺势而生,单页面应用简称`SPA`,即Single Page Application,就是只有一个HTML页面的应用 ...
- Android中使用ViewPager实现屏幕页面切换和页面切换效果
之前关于如何实现屏幕页面切换,写过一篇博文<Android中使用ViewFlipper实现屏幕切换>,相比ViewFlipper,ViewPager更适用复杂的视图切换,而且Viewpag ...
- ViewPager之Fragment页面切换
一.概述 ViewPager是android-support-v4中提供的类,它是一个容器类,常用于页面之间的切换. 继上篇文章<ViewPager之引导页>之后,本文主要介绍ViewPa ...
- html tab页面切换事件。
$(document).bind("visibilitychange",function(e){ //只对tab页面切换有效 //document.visibilityState ...
- vue-lazy-render: 延迟渲染大组件,增强页面切换流畅度
最近用element来做项目,在开发的过程中,突然发现页面的操作和切换在数据量大的时候相当卡,后来提了个issue,在furybean解答后才知道,我每个单元格都加了tooltip,会生成大量的节点, ...
- 第54课 Qt 中的多页面切换组件
1. 多页面切换组件(QTabWidget) (1)能够在同一个窗口中自由切换不同页面的内容 (2)是一个容器类型的组件,同时提供友好的页面切换方式 2. QTabWidget的使用方式 (1)在应用 ...
随机推荐
- WebGL_0002:palycanvas 配置文件路径
playcanvas 配置文件路径https://s3-eu-west-1.amazonaws.com/apps.playcanvas.com/wmSPTNhb/config.jsonsence 地址 ...
- MY_0003:设置界面显示单位
1,设置单位
- fqa0
FQA 0 - Plan 9 简介 0.1 - 什么是 Plan 9 Plan 9 是一个研究操作系统,来自于在 Bell 实验室计算机科学研究中心(CSRC)同样创造了 UNIX 的团队.它出现在2 ...
- JS表单验证源码(带错误提示及密码等级)
先晒图 index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...
- 小希的迷宫 HDU - 1272
#include<iostream> #include<algorithm> #include<cstring> using namespace std; cons ...
- NOI Online能力测试游记:退役选手的自娱自乐
2020年2月17日早上8点,CCF发布了关于举办NOI Online能力测试的通知. 为给选手提供一个锻炼的机会,CCF拟举办一场NOI Online能力测试.测试分为入门组和提高组,每组限额报名3 ...
- Win10下安装tensorflow详细过程
首先声明几点: 安装tensorflow是基于Python的,并且需要从Anaconda仓库中下载. 所以我们的步骤是:先下载Anaconda,再在Anaconda中安装一个Python,(你的电脑里 ...
- data_analysis 第一课
1.anaconda的安装与使用 在官网下载anaconda的客户端,因为python有2和3之分,所以有两个版本可以供选择,由于该课程使用2作为开发工具,选择anaconda2下载安装. 安装好之后 ...
- 转载:arm neon intrinsic
转自:https://blog.csdn.net/hemmingway/article/details/44828303/ https://blog.csdn.net/chshplp_liaoping ...
- [TJOI2013] 奖学金 - 堆
按 a 排序,暴力用堆维护两侧预处理, 然后枚举中位数即可 #include <bits/stdc++.h> using namespace std; #define int long l ...