1
2
3
4
5
6

An Odd Error With CompositeWPF and Other Embedded Controls

I just spent a few minutes trying to figure out an odd error I was having in trying to add Kevin's WPF Bag-o-Tricks to my MemoryGame project. Apparently if you make use of such a 3rd party control (or anything with a different app domain) in one XAML file and then attempt to put that XAML page into another XAML page (whose project does not contain a reference to said 3rd party library) you will get this lovely error:

WPF Friendly Frameworks and Design Patterns

Since I last posted I have still been relatively hard at work learning a variety of things. One thing which I have noticed recently is that once you get a basic sense of WPF/XAML/etc. you'll probably have been exposed to so many other things relative to WPF to learn that you'll spend less and less time UI/XAML coding and more and more time researching new technologies that seem to go hand-in-hand with WPF.

One of the interesting paradigms with the Windows Forms -> WPF switch is that if you are going to take the time to move to WPF you are likely to do a good bit of architecting, or be able to include other new features in .Net 3.5, etc. Maybe now is the time to also bring in other new things you've wanted in your codebase - maybe better unit testing, LINQ, new design patterns, etc. Maybe in trying to learn WPF and build your new product you've realized you need a good architecture to go along with the new app as well?

I would suggest that if you are going to be doing some WPF work you probably should be familiar with design patterns and frameworks which work well with it. A good example would be CompositeWPF - also known as "The Composite Application Guidance for WPF" or Prism. What you'll find on codeplex and this corresponding MSDN page is a WPF friendly design pattern framework from Microsoft complete with a bunch of source code examples, documentation, etc.

A few of the technologies incorporated into CompositeWPF are a dependency injection(DI) (or Inversion of Control (IoC)) implementation named Unity (somewhat like a more advanced form of a service-locator design pattern), implementations of the Model View ViewModel (MVVM) design pattern (a widely accepted WPF friendly replacement for MVC or MVP), and several other notable technologies you will probably want to check out as well.

What's great about learning these frameworks is that just like trying to learn XAML/WPF there are lots of good resources out there. Searching for any of the keywords above can give you plenty to read and look into, but before you get started I would highly suggest this recent hour long episode on .Net Rocks on exactly these topics: dnrTV Show #124 - Brian Noyes on Prism. Also, once you get into the QuickStarts which come with the framework be sure to use this corresponding page to know what is going on in the examples.

Well, I'm off to keep looking through the example projects that come with CompositeWPF, and maybe try out my own implementation. Until next time!