创建父窗口? [英] Create a Parent Window?

查看:87
本文介绍了创建父窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在WPF中使Parentwindow在其中显示多个子窗口以给用户分页感?

how to make a Parentwindow show multiple childwindows inside it in WPF to give a paging feeling to the user?

推荐答案

窗口之间没有父子关系在WPF中. (甚至在Forms中,这种从Control继承的关系实际上也不起作用.)

要感觉到分页,您只能使用一个主窗口(顺便说一句,对于大多数应用程序是最佳选择)和不同的布局设计.例如,您可以使用StackPanel托管一组其他面板.您作为子"窗口使用的将是这些子面板之一.在这种情况下,可以使用常规滚动条来控制页面.

或者,您可以从数据中动态加载带有子控件的某些面板,并使用一些实现左右"命令的控件(如果需要,可以使用上下")来翻转页面.

如果这种面板的数量不是很大,则可以修改上述设计.您可以预先创建它们并控制它们的可见性:隐藏一个,然后全部隐藏,这样就可以洗净唯一可见的子面板.

这些只是最简单的想法.我看到了许多带有动画的高级设计,例如,人们实现了许多翻页书的设计.

参见:
http://wpfbookcontrol.codeplex.com/ [ ^ ],
http://blogs.msdn.com/b/mitsu/archive/2006/11/05/flip-page-demo-using-wpf.aspx [使用WPF 3.5创建带有语音和墨水的3D书形应用程序 [ http://windowsclient.net/downloads/folders/wpfsamples/entry5100.aspx [ ^ ].

如果您有Google,就能找到更多信息.

—SA
There is no parent-child relationship between windows in WPF. (And even in Forms, such relationship inherited from Control is not really functional.)

To make a feel of paging you can use just one main window (best option for most applications, by the way) and different layout designs. For example, you can use StackPanel hosting a set of other panels. What you though as of a "child" windows will be one of those children panels. In this case control of pages could be done using a regular scroll bar.

Alternatively, you can dynamically load some panels with children controls from data and flip-page those panel using some control implementing Left-Right commands (or Up-Down if you prefer).

The design described above could be modified if the number of such panels a not so big. You can pre-create them all and control their visibility: hide all but one and this way shuffle the only visible child panel.

These are just the simplest ideas. I saw a number of advanced design with animation, etc. For example, people implemented a number of flip-page book designs.

See:
http://wpfbookcontrol.codeplex.com/[^],
http://blogs.msdn.com/b/mitsu/archive/2006/11/05/flip-page-demo-using-wpf.aspx[^],
Creating a 3D book-shaped application with speech and ink using WPF 3.5[^],
http://windowsclient.net/downloads/folders/wpfsamples/entry5100.aspx[^].

You will be able to find more if you Google.

—SA


这是您要完成的事情吗?

http://msdn.microsoft.com/en-us/library/ms750478.aspx [ ^ ]
Is this what you are trying to accomplish?

http://msdn.microsoft.com/en-us/library/ms750478.aspx[^]


这篇关于创建父窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆