none
WPF Composite controls - conceptual question RRS feed

  • Question

  • Hi to all!

    I'm new to WPF. I have experience with building composite controls in ASP.NET, AJAX.NET, WinForms...

    I have general question about architecting the app. Lets say my whole layout will be made in a 3x3 grid. One cell will be the header, one cell wil have main navigation and one will be the container for user controls that will show/hide based on user menu selection. My general question is: where should I do the logic saying: 'if menuItem x was pressed > render x userControl'? Is the Windows right place for that? Additionaly, should I probably keep reference to user controls container somewhere in the Window object instead of traversing visual tree each time?

    Other question is: should I keep my custom user controls collection to be able to switch them on/of or is there some other way to do it? And at the end, should I load all controls at startup and use show/hide or should I use dynamic controls load on menuItem clicked?

    Thanks!

    Wednesday, March 2, 2011 12:46 PM

Answers

  • WPF already has a solution for the type of application you are trying to build.  It is called Prism and it was built by Microsoft's Patterns and Practices team.  It is used to build composite applications and provides guidance for exactly what you are asking.  You can get started here:

    http://compositewpf.codeplex.com/

    • Marked as answer by vestibulzg Wednesday, March 2, 2011 3:42 PM
    Wednesday, March 2, 2011 3:14 PM

All replies

  • WPF already has a solution for the type of application you are trying to build.  It is called Prism and it was built by Microsoft's Patterns and Practices team.  It is used to build composite applications and provides guidance for exactly what you are asking.  You can get started here:

    http://compositewpf.codeplex.com/

    • Marked as answer by vestibulzg Wednesday, March 2, 2011 3:42 PM
    Wednesday, March 2, 2011 3:14 PM
  • That gave me an idea what should I do in my app.

    Thanks!

    Wednesday, March 2, 2011 3:42 PM