当前位置:网站首页>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事件就可以触发了
或者采用广播的形式 但是比较复杂边栏推荐
- 2022-7-7 Leetcode 34.在排序数组中查找元素的第一个和最后一个位置
- Excuse me, when using Flink SQL sink data to Kafka, the execution is successful, but there is no number in Kafka
- TPG x AIDU | AI leading talent recruitment plan in progress!
- How can the PC page call QQ for online chat?
- LeetCode简单题分享(20)
- SSRF漏洞file伪协议之[网鼎杯 2018]Fakebook1
- Details of redis core data structure & new features of redis 6
- 请问,PTS对数据库压测有好方案么?
- Laravel5 call to undefined function openssl cipher iv length() 报错 PHP7开启OpenSSL扩展失败
- XML文件的解析操作
猜你喜欢

Evolution of customer service hotline of dewu

Mathématiques avancées - - chapitre 8 différenciation des fonctions multivariables 1

Redis can only cache? Too out!

Co create a collaborative ecosystem of software and hardware: the "Joint submission" of graphcore IPU and Baidu PaddlePaddle appeared in mlperf

566. Reshaping the matrix

DID登陆-MetaMask

MySQL error 28 and solution

. Net core about redis pipeline and transactions

2022-7-7 Leetcode 34. Find the first and last positions of elements in a sorted array

Advanced Mathematics - Chapter 8 differential calculus of multivariate functions 1
随机推荐
Take you to master the three-tier architecture (recommended Collection)
Best practice | using Tencent cloud AI willingness to audit as the escort of telephone compliance
Use day JS let time (displayed as minutes, hours, days, months, and so on)
2022-7-6 sigurg is used to receive external data. I don't know why it can't be printed out
The meaning of variables starting with underscores in PHP
MySQL "invalid use of null value" solution
Sliding rail stepping motor commissioning (national ocean vehicle competition) (STM32 master control)
Laravel Form-builder使用
请问,在使用flink sql sink数据到kafka的时候出现执行成功,但是kafka里面没有数
Co create a collaborative ecosystem of software and hardware: the "Joint submission" of graphcore IPU and Baidu PaddlePaddle appeared in mlperf
FC连接数据库,一定要使用自定义域名才能在外面访问吗?
Excuse me, as shown in the figure, the python cloud function prompt uses the pymysql module. What's the matter?
postgresql array类型,每一项拼接
How can the PC page call QQ for online chat?
requires php ~7.1 -&gt; your PHP version (7.0.18) does not satisfy that requirement
Excuse me, when using Flink SQL sink data to Kafka, the execution is successful, but there is no number in Kafka
Custom thread pool rejection policy
PC端页面如何调用QQ进行在线聊天?
What are the principles for distinguishing the security objectives and implementation methods that cloud computing security expansion requires to focus on?
THINKPHP框架的优秀开源系统推荐