2

I have created a new WPF Application using Visual Studio 2010 so I have a default MainWindow.xaml, I have created a folder 'Views' which holds a couple of xaml pages that are different views for my app.

What I want to do is to have these views in the MainWindow.xaml and transition between them at certain time intervals. Could anyone give me an idea on how to achieve this?

Thanks!

Mohammed A. Fadil
  • 9,205
  • 7
  • 50
  • 67

2 Answers2

0

You need to define how child forms will be displayed inside your MainWindow, there are several ready made solutions for this problem, check-out these links:

Mohammed A. Fadil
  • 9,205
  • 7
  • 50
  • 67
  • Thanks for the links..I will have a read through. I did just want a simple solution e.g my MainWindow will just be a blank window that will act as a holder for my views allowing me to slide between them automatically whilst full screen. – CollyMellon Apr 26 '12 at 11:49
  • Check this simple implementaion [Tabbed WPF UI](http://stackoverflow.com/questions/1026912/tabbed-document-interface-in-wpf-using-only-on-board-means) – Mohammed A. Fadil Apr 26 '12 at 13:35
0

For a simple scenario (without any complications or etc), you would do the same as you would do with a parent object composing a set of child objects.

Class A{
private View FirstView;
private View SecondView;

...

}

then you would want to visually place it inside your UI hierarchy as in a child of a Grid or a Canvas for an instance.

For a better use, try DI or IoC container in order not be worried about creating the object and keeping references.

http://code.google.com/p/autofac/

You might also want to think about the communication between your Views and Window. For that, please have a look at EventAggregator implementations

https://stackoverflow.com/questions/2343980/event-aggregator-implementation-sample-best-practices

Community
  • 1
  • 1
Tarek Khalil
  • 405
  • 4
  • 13
  • Your first suggestion is what I will try - I'm very much a beginner at WPF. When I have my class defining my views how can visually place that on my MainWindow page and then start transitioning between them? Thanks for the help. – CollyMellon Apr 26 '12 at 11:53