我可以在contentcontrol / frame中打开一个窗口

编程入门 行业动态 更新时间:2024-10-24 22:20:06
本文介绍了我可以在contentcontrol / frame中打开一个窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是WPF的新手。我在这里知道,我们可以在一个wrappanel / frame / contentcontrol或任何其他面板中加载WPF窗口。 我有一个带有框架的MainPage。在菜单上选择我需要在该框架内打开一个新的wpf窗口。我尝试使用page和usercontrol。问题是,当功能完成时,页面和用户控件无法关闭(例如: - 学生注册)。或者是否有任何其他方法可以打开注册窗口并在完成注册后关闭它。 提前感谢...

Hi, I'm new in WPF. I'm here to know, can we load a WPF windows inside a wrappanel/ frame/ contentcontrol or any other panel. I'm having a MainPage with a frame. On menu select i need to open a new wpf window inside that frame. I tried it on using page and usercontrol. What the problem is, the page and usercontrol can't close when the function is completed (eg:- student registration). Or is there is any other methods to open Registration window and close it after finishing the registration. Thanks in advance...

推荐答案

您可以在主页面中使用Tab控件,然后为您的学生注册表单创建用户控件。在选择学生注册菜单项时,添加一个TabItem并将学生注册用户控件添加到TabItem。注册完成后,您可以关闭TabItem。 You can have a Tab control in the main page, then create user control for your student registration form. On selection of student registration menu item add one TabItem and add student registration user control to TabItem. Once registration completed you can close the TabItem.

您可以在单个WPF窗口中创建多个用户控件。 Usercontrol xaml :您的设计需要以表格形式显示 Usercontrol xaml.cs:该页面的逻辑,如事件处理等.. Mainwindow Xaml: grid 内容控制x:name =cntctrlxmlns:x =#unknown/> / grid Mainwindow xaml.cs: 使用//名称空间usercontrol ... //你需要编写这段代码的构造函数 cntctrl.content = nameofusercontrol (); 认为它可以帮助你... You can create number of user controls in single WPF window. Usercontrol xaml: Your design which need to be displayed in Form Usercontrol xaml.cs: Logic for that page like event handling etc.. Mainwindow Xaml: grid content control x:name="cntctrl" xmlns:x="#unknown" /> /grid Mainwindow xaml.cs: using //Name space of usercontrol... //constructor you need to write this code cntctrl.content=nameofusercontrol(); Think it helps you...

更多推荐

我可以在contentcontrol / frame中打开一个窗口

本文发布于:2023-08-07 18:18:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1320843.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:窗口   contentcontrol   frame

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!