wpf – 通过XAML将Window.Content设置为页面?
发布时间:2020-12-14 02:52:39 所属栏目:Windows 来源:网络整理
导读:Window x:Class="MyWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:src="clr-namespace:WpfApplication1" Title="ContactsSelector" Height="300" Width="300"
<Window x:Class="MyWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:src="clr-namespace:WpfApplication1" Title="ContactsSelector" Height="300" Width="300"> <Window.Content> <src:MyPage> <!--MyPage is a page that I created and exists in the project--> </src:MyPage> </Window.Content> </Window> 我想将窗口的内容设置为页面,就像我以编程方式执行它一样: Dim w As New MyWindow Dim p As New MyPage w.Content = p w.ShowDialog() 或者在窗口的Load事件中设置它,简单地说我希望它在xaml中完成. 解决方法
使用Frame元素显示页面的内容.
<Window> <Frame Source="/Pages/MyPage.xaml"/> </Window> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 数组 – 在多行中批量创建数组
- Windows命令无法运行报错:is not recognized as an intern
- 配置Windows Server 2008路由器
- Windows DNS – 区域从未加载
- 当使用cx_Freeze和tkinter时,我得到:“DLL加载失败:找不到
- windows – 为什么“Program Files”有两个单词?
- windows – 在屏幕上保留RScript生成的图,直到用户交互
- windows-phone-7 – 防止Windows Phone中的Pivot导航
- winapi – Windows SDK 7.0的signtool中的signwizard发生了
- sublime使用技巧记录
推荐文章
站长推荐
- DirectX11--教程项目无法编译、运行的解决方法
- windows-server-2003 – 如何在本地Windows服务器
- windows-server-2008 – 在Outlook中几分钟后自动
- Windows BAT:测试特定文件是否为空
- powershell – 如果/ ElseIf阻止不使用-or
- xaml – 如何将控制高度数据绑定到另一个控件的高
- windows-xp – GnuPG:“解密失败:秘密密钥不可
- 运行JBoss 7.1.1.Final作为Windows服务
- 安装Windows Azure Storage v3.0.3使用NuGet失败
- Windows API一日一练 61 GetDriveType函数
热点阅读