简体   繁体   中英

How to create WPF application with multiple XAML files?

I am developing a simple WPF application and I can create a single MainWindow with controls, content, etc.

However, I want to split my app. And I have a problem to build an app with welcome screen where user can choose between two modes, as seen below:

欢迎画面

After click on Learn button I want to load this XAML:

学习模式

And after click on Next (from Learn screen) or Recognize (from Welcome screen) I want to load this XAML:

识别方式

...everthing in the same MainWindow.

I can't even name what I am trying to achieve. Do I want pages ? Or views ?

How to handle this situation in WPF ?

This you can do it in many ways. Basic thing is place each functionality in different user control, so that you can chose to load them at the run time

  1. Have different user controls and hide all except the first one, depending on the users selections you show the on you want or

  2. Use Content Presenter, depending the user selection load the controls at run time in to the content presenter.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM