如何在wpf中将窗口窗体调用为tabcontrol [英] How to Call a window form into a tabcontrol in wpf

查看:82
本文介绍了如何在wpf中将窗口窗体调用为tabcontrol的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我是wpf的新手,对C#有一点了解。

我设计了一个表格停靠面板左侧底座上的按钮,以及带有tabcontrol的中间部分。



所以当我点击左侧停靠栏中的按钮时,我需要一个标签在中心码头,我使用其他形式设计的控件具有确切的位置。



例如:



如果单击用户按钮,我需要在tabcontrol中显示user.xaml表单。

如果单击客户按钮,我需要显示customers.xaml表单。 />


我用C#做过但我不知道wpf。



谢谢

hi everyone,

I am new to wpf , and have a little knowledge in C#.
I designed a form with some buttons on the left dock of dock panel, and the center part with a tabcontrol.

So when i click a button in the left dock, i need to have a tab in the center dock, with controls I designed in other forms with exact positions.

For eg:

If I click the user button, I need the user.xaml form to be displayed in the tabcontrol.
If I click the customer button, I need the customers.xaml form to be displayed.

I have done it in C# but I have no idea in wpf.

Thank You

推荐答案

没有这样的概念,叫一个表格。此外,如果您是WPF的新手,您可能不知道许多WPF功能和技术可以释放您,然后需要在WPF中使用 System.Windows.Forms 。所以,我的第一个建议应该是用纯WPF开发你的所有应用程序,没有任何形式。



但是如果你真的需要在WPF中使用Forms(即使你的描述并不能证明它有点合理),你可以做到。请从这里开始: https://msdn.microsoft.com/ en-us / library / vstudio / ms751761%28v = vs.100%29.aspx [ ^ ]。



顺便说一下,另一个方法也可以: https://msdn.microsoft。 com / zh-CN / library / vstudio / ms742215%28v = vs.100%29.aspx [ ^ ]。



最后,只是为了完整性:我做了一些研究来验证:你可以使用以下相当奇特的可能性:在单个进程和单个应用程序中,你可以在一个线程中运行一个UI,在另一个线程中运行另一个UI,或者你可以拥有更多这样的线程。这样,一个线程可以运行WPF UI,另一个线程可以运行 - 表单UI。这甚至很容易做到。我并不是说它具有任何实际意义。



-SA
There is no such concept, "call a form". Besides, if you are new to WPF, you may not know many WPF features and techniques which could free you then need to use System.Windows.Forms in WPF at all. So, my first advice should be to develop all your applications in pure WPF, without any forms.

But if you really need to use Forms in WPF (even though your description does not justify it even a bit), you can do it. Please start here: https://msdn.microsoft.com/en-us/library/vstudio/ms751761%28v=vs.100%29.aspx[^].

By the way, the other way around is also possible: https://msdn.microsoft.com/en-us/library/vstudio/ms742215%28v=vs.100%29.aspx[^].

And finally, just for completeness: I have done a little research to validate: you can use the following rather exotic possibility: in a single process and single application, you can run one UI in one thread, and another UI in another thread, or you can have more threads like that. This way, one thread can run WPF UI, and another one — Forms UI. This is even easy to do. I'm not saying it's of any practical significance though.

—SA


这篇关于如何在wpf中将窗口窗体调用为tabcontrol的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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