当前位置:网站首页>c#通过frame 和 page 切换页面
c#通过frame 和 page 切换页面
2022-07-07 12:10:00 【孔雀东南飞-深圳】
背景 需要给一个项目添加licence功能 需要做个licence 页 然后mainwindow里面切换主页和登录页 为此 需要将 页面分开来
实现思路 在 mainwindow 中创建一个 frame 然后在对应的 cs 依据 licence 来判断是否加载主页
1 在 mainwindow 中使用 frame
<Grid>
<Frame
Grid.Row="1"
x:Name="frmMain"
Margin="0,0,0,0"
NavigationUIVisibility="Hidden" FontSize="18">
</Frame>
</Grid>
2 创建page 添加现有项 选择page 例如添加了 MainHolePage.xaml
3 在mainwindow 中指定显示的页
frmMain.Source = new Uri("View/MainHoldPage.xaml", UriKind.Relative);
ps:
1 添加到page之后发现keydown事件不能触发 后来解决了:
1 在 page 中写:
Loaded="Page_Loaded"
2 在对应的事件中写:
private void Page_Loaded(object sender, RoutedEventArgs e)
{
var window = Window.GetWindow(this);
window.KeyDown += Page_KeyDown;
}
3 然后page的keydown事件就可以触发了
或者采用广播的形式 但是比较复杂
边栏推荐
- FCOS3D label assignment
- docker部署oracle
- Is it safe to open an account online now? Which securities company should I choose to open an account online?
- SSRF vulnerability file pseudo protocol [netding Cup 2018] fakebook1
- 使用day.js让时间 (显示为几分钟前 几小时前 几天前 几个月前 )
- PostgreSQL array type, each splice
- Details of redis core data structure & new features of redis 6
- Vmware共享主机的有线网络IP地址
- 【日常训练--腾讯精选50】231. 2 的幂
- Indoor ROS robot navigation commissioning record (experience in selecting expansion radius)
猜你喜欢
Supply chain supply and demand estimation - [time series]
How to check the ram and ROM usage of MCU through Keil
Thread pool reject policy best practices
2022-7-6 使用SIGURG来接受外带数据,不知道为什么打印不出来
2022-7-6 Leetcode27.移除元素——太久没有做题了,为双指针如此狼狈的一天
Custom thread pool rejection policy
Take you to master the three-tier architecture (recommended Collection)
Use day JS let time (displayed as minutes, hours, days, months, and so on)
566. 重塑矩阵
Redis只能做缓存?太out了!
随机推荐
118. 杨辉三角
2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array
Transferring files between VMware and host
toRaw和markRaw
Excusez - moi, l'exécution a été réussie lors de l'utilisation des données de puits SQL Flink à Kafka, mais il n'y a pas de nombre dans Kafka
Laravel Form-builder使用
Take you to master the three-tier architecture (recommended Collection)
. Net core about redis pipeline and transactions
Laravel form builder uses
请问,我kafka 3个分区,flinksql 任务中 写了 join操作,,我怎么单独给join
参数关键字Final,Flags,Internal,映射关键字Internal
Learning breakout 2 - about effective learning methods
XML文件的解析操作
.net core 关于redis的pipeline以及事务
Mysql怎样控制replace替换的次数?
Mathématiques avancées - - chapitre 8 différenciation des fonctions multivariables 1
566. Reshaping the matrix
Help tenants
室内ROS机器人导航调试记录(膨胀半径的选取经验)
Social responsibility · value co creation, Zhongguancun network security and Information Industry Alliance dialogue, wechat entrepreneur Haitai Fangyuan, chairman Mr. Jiang Haizhou