Boise Code Camp Prism, Ocean 3 Session

March 24, 2012

The links to the code presented at the Boise Code Camp is in the below Downloads section.

This links include Ocean 3 and a modified Prism 4 library that has two new features.

The Ocean 3 solution includes a Prism Ocean Demo application that shows off Ocean working with Prism. In a later release, I’ll add database demonstration code as well that uses the new and improved Service<T> and Repository<T>.

The demo application shows off:

  • WPF Ribbon being populated by a Prism Region; when forms are navigated to, their respective ribbon tabs are automatically rendered.
  • Automatic view/view model wiring up by the Unity container. No view or view model navigation registrations required.
  • Automatic setting of the correct IRegionManager on all view models; this region adapter does not draw the IRegionManager out of the IoC container, instead it uses the one assigned to the view. This technique prevents the incorrect IRegionManager being assigned in cases of child windows or scoped regions.
  • Demonstration of a child window hosting a form; that same form can be shown within the shell or child window requiring no form or view model modifications to function correctly; i.e. no “if in popup then do this code.”
  • When views are navigated away from, the currently focused control is cached; when that same instance of that form is navigated back to, focus will automatically be set to the correct control.
  • Queued dialog service for forms.
  • The view modal dialogs are asynchronous, by not blocking the UI thread, a form that has a dialog displayed, can be navigated away from and navigated back to.
  • When a view has a view modal dialog displayed, the views ribbon tabs are automatically disabled.
  • Ocean FormControl that provides many services for LOB forms.
  • Ocean FormNotificationControl that shows the form status from a validation perspective.
  • Ocean provides a comprehensive validation stack.
  • In addition, many small features are also shown.

I’ll release a new version of BBQShack soon, PrismBBQShack. This is a complete end-to-end store application that will show off all features of Ocean 3 (like the data stack) and will have a Win8, WinRT XAML touch-enabled point of sale application.


After downloading, you MUST read the READ ME NOW.txt file in the Acme.Example solution.

After downloading, you must rename the to downloads from .zip.doc to .zip.  This is a requirement of Word Press.

Ocean 3

Modified Prism 4

To use the modified Prism 4 download, after unzipping, go to the \Prism\Prism4\ folder and run these two batch files:

  • Run Update Prism Binaries.bat
  • RegisterPrismBinaries.bat

They will rebuild the supplied modified Prism 4 and will register this version of Prism in the registry so that you can use the Add References dialog. This modified version of Prism will work with any current Prism application as no API’s were removed or changed, only added.

Have a great day,

Just a grain of sand on the worlds beaches.

Boise Prism, Unity, WPF, MVVM Code and Decks

June 29, 2011

Everyone had a great time in Boise this week with developers from the United Kingdom and all over the United States.  WPF is alive and well and being used in corporate development along with Prism!


C# early version of Ocean.

  • Data Binding
  • M-V-VM
  • Commands in M-V-VM
  • Dialogs in M-V-VM
  • Data Validation
  • M-V-VM Tips & Tricks
  • Unit Testing & Moq
  • Introduction to Prism
  • Unity and Dependency Injection
  • Shell and Bootstrapping
  • Modules
  • Regions
  • Events
  • Navigation


The download includes PowerPoint decks for most of the sessions and source for all sessions.  Also included is an  Extras folder with goodies.


You can download the code and decks from my Sky Drive here.

Have a great day,

Just a grain of sand on the worlds beaches.

Stuff – WPF Line of Business Using MVVM Video Tutorial

May 9, 2010

Stuff is an example application I wrote for WPF Line of Business Tour at Redmond event.  During some of the event sessions I used the code in Stuff to demonstrate topics I was teaching. 

During the event, we did not do an end-to-end examination of Stuff, that is the purpose of this blog post. 



In its current form, Stuff is a demo application that allows you to store information about the movies you own.  It uses the Netflix OData cloud database for movie look up, which makes adding a movie to your collection very easy.

One goal for Stuff was that a developer could take the code, open it in Visual Studio 2010 and press F5 and run the application.  I didn’t want burden developers with setting up a database, creating an account to use an on-line service or have to mess with connection strings, etc.

The Netflix OData query service made my goal achievable because it has a very low entry bar.

Stuff v2.  Shortly, I’ll modify Stuff by swapping out the remote data store layers and point it at Amazon’s web service so that I can not only look up movies but books, music and games too.  The reason I didn’t do this up front was because developers would have to go and get an Amazon account just to use and learn from the application. 

Another goal I had for Stuff was to limit referencing other assemblies or frameworks including my own.  All the code for Stuff is in the solution except the Prism EventAggregator.  I hope that trimming the code down to exactly what is being used in the application helps with the learning process.

There is a complete solution in both C# and VB.NET.


You won’t see an individual video on MVVM below, because its not needed.  Instead, when appropriate I make mention of MVVM in the videos.

MVVM is a super simple pattern that describes a way to think about WPF and Silverlight applications.  When thinking in MVVM, we think in terms of a Model (our data), View (our UI) and ViewModel (traffic cop, abstraction of the View and adapter for the Model all rolled up into a single class). 

The Model, View and ViewModel typically communicate using the rich data binding stacks of WPF and Silverlight.

MVVM stands by itself and does not require an additional framework or special skills to use. 

I’ve seen developers investigating MVVM get discouraged when they see MVVM applications that take advantage of advanced features like IOC containers, service locators or MEF; in-effect lumping other programming concepts or API’s into MVVM.  If this happened to you, take a step back and get to know and understand MVVM for what it is, “a way to think about WPF and Silverlight applications.”

When writing WPF or Silverlight applications you may want to take advantage of an IOC container, service locator or MEF, but these are not required to use the MVVM pattern in your applications. 

As you gain experience in how you think about WPF and Silverlight application architecture and design patterns used to create these applications, you’ll find that the advance concepts are actually not that difficult and really do add value to your projects.

If MVVM is new to you, take it slowly, the light will come on.  For example, when you think about a Button, instead of thinking in terms of the Click event handler, you’ll think about data binding the Button’s Command property to an ICommand property on the ViewModel;  instead of thinking about addressing a control in the code-behind file by name, you’ll ask yourself, “what property do I need to expose on my ViewModel” that the UI control can data binding to.

MVVM is a very natural way to think about WPF and Silverlight applications, enjoy the learning journey and have fun.

Stuff Application Video Tutorial

Instead of writing a long blog post, I decided to tell the Stuff application’s story through a series of 14 short videos on different topics. 

I’ve tried real hard to keep each of the following videos short and focused.  The videos are all 1400 x 900.  To the get most from the videos, please read this very short blog post Karl’s Vimeo videos.

Introduction to the Stuff application

Video covers using the Stuff application and where Stuff stores your data locally.

Solution and project structure

Video covers the how and why the solution and projects are structured the way they are.

Introduction to OData

Video gives a short introduction to OData and querying OData sources.

Abstracting the remote data store

Video explains how the Stuff application abstracts the remote data store for the purpose of allowing the concrete implementation to be easily changed in the future or for test purposes.

Business Entity Objects

Video explains the entity objects used in Stuff.  A short explanation of how I implemented searching the local Stuff data store is also provided.

BusinessEntityBase and Validation

Video explains the BusinessEntityBase class and entity validation in Stuff.  Stuff uses the Data Annotations attributes to decorate class properties with validation rules.  This is a proof of concept that I wanted to try to see how far Data Annotations would take me.

Service Container

Video explains the ServiceContainer (ServiceLocator) used in Stuff.  ServiceContainers provide a mechanism for resolving concrete types at run-time, design-time and test-time for the various services your application exposes.


Video explains how simple it is to implement a dialog service that your ViewModels can consume.  The swapping out of the concrete implementation is also covered.


Video introduces the Prism Event Aggregator and how Stuff implements an IEventAggregatorService.  Event Aggregator enables creating decoupled applications by disconnecting the initiating object (publisher) from the receiving object (subscriber).


Video covers the local data store used by Stuff to persist its data.  Additionally, it explains how local binary serialization and deserialization is used for loading and saving data and how to workaround a problem with binary deserialization in Expression Blend 3 and 4 that is caused by Blend not reloading its application domains between builds.

VisualStateAssistant AttachedProperty

Video explains the VisualStateAssistant AttachedProperty that enables the changing of VisualStates in the UI from a ViewModel using data binding.

Behaviors in Stuff

Video explains the Expression behaviors used in the Stuff application and how to wire them up.

Design-time Visual Studio and Blend support

Video explains what I did to enabled a good design-time experience in the Stuff application in both Visual Studio and Expression Blend.  Video covers the design-time services and design-time data as well as some issues you need to deal with with each of the tools.

Dispatcher, BackgroundWorker and WebClient

Video covers the use of the Dispatcher in the Stuff application and how I used posting to the Dispatcher to set focus to controls after UI transitions.  I also cover using the BackgroundWorker for performing background  search operations and using the WebClient to asynchronously download images.


If you have not installed Expression Blend 4, then your system will not have the Expression Blend SDK assemblies and you won’t be able to compile the solution. 

I have added a folder to the solution named, “Expression SDK Dlls.”  If you do not have Blend installed, you’ll need to update the references to the Blend SDK assemblies by removing the broken references and re-adding the reference to the dll in the above folder.

C# Source Code

VB.NET Source Code


Hope you can learn just a little bit more about WPF Line of Business application programming from this example.

Have a great day,

Just a grain of sand on the worlds beaches.

Announcing the "WPF for LOB" Training Tour

April 2, 2009

After our initial M-V-VM training sold out, I am delighted to announce our new series of WPF training for April/May/June.

Jaime Rodriguez and I created our best offering to-date: two days packed with WPF, optimized for building business applications, and in these locations:  Los Angeles, CA – London, UK – New York, NY – Chicago, IL – Phoenix, AZ

Please join us, and please help us spread the word about the free training!!

Invitation and Complete Information

Training Event Information and Registration

Have a great day,

Just a grain of sand on the worlds beaches.

Registration Now Open for Enterprise Developers Guild Code Camp on 17 May 2008

May 1, 2008

On Saturday 17 May 2008, the Enterprise Developers Guild will have their spring Code Camp at the CPCC Central Campus located in Charlotte, NC.

Directions and registration is posted here:

Code Camps are very informative, free and fun.

Code Camp Tracks

  • WPF Multi-Tier Business Application Track
  • VS 2008 / SQL 2008 Labs Track
  • Agile Track
  • Presentation Track

I have updated the information on the WPF Multi-Tier Business Application Track that you can read here:

See You At Code Camp!

Have a great day!

Just a grain of sand on the worlds beaches.

WPF Multi-Tier Business Application Track at the Enterprise Developers Guild Code Camp on 17 May 2008

April 6, 2008

Code Camp

On Saturday 17 May 2008, the Enterprise Developers Guild will have their spring Code Camp at the CPCC Central Campus located in Charlotte, NC. 

Directions and registration is posted here: Developers Guild Code Camp Registration 

Code Camps are very informative, free and fun. 

The following describes the WPF Multi-Tier Business Application Track.

In a Nutshell

Windows Presentation Foundation is the desktop user interface platform introduced in the Microsoft .NET Framework 3.0 and enhanced in the .NET Framework 3.5. It combines the best ideas of Windows Forms and ASP.NET, and then brings a broad range of new features to the table. WPF requires Architects and Developers to rethink the way they design and implement smart client applications.

In this seminar, you can get a head start by learning how to design and develop WPF business applications from Josh Smith and Karl Shifflett; two guys who have been working with WPF for years. Additionally Josh and Karl are both Microsoft MVP’s and Code Project MVP’s.

Curriculum Review


Before diving into WPF, first briefly get to know Josh and Karl and then have quick overview of what we will cover throughout the day.

WPF UI Architecture

Buildings must rest on a firm foundation in order to avoid falling over. The same holds true for a complex application’s user interface. This session covers fundamental topics necessary for creating a solid foundation upon which large, dynamic, user-friendly business applications can grow.

Data Binding

WPF is all about data binding. It is a core feature of the WPF framework, and professional WPF Developers must thoroughly understand it to be productive. This session reviews the fundamentals of WPF data binding and shows how to leverage data binding in real-world user interfaces.

WPF-Friendly Business Objects

The user interface is just one part of a smart client application. Enabling other parts of your system to leverage the rich capabilities of WPF requires some extra planning and foresight. This session explains how to create business objects that work well with WPF.

Advanced Data Binding

Business data is complicated. Displaying, editing, and validating complex data requires the use of advanced data binding techniques. This session shows how to use the features of WPF data binding that enable Developers to manage the complexity of their data.

WPF Tools & Performance Testing

The WPF community is full of great free utilities and tools that make it easier to program in WPF. This session shows how to use many of the tools, including several tools that aid in testing the performance of a WPF user interface.

MVC and Unit Testing

The Model-View-Controller and Model-View-Presenter patterns are time-tested, developer-approved solutions for creating modular, loosely coupled application architectures. One of the key benefits of using those patterns is that the system is much easier to unit test. This session dives deep into how you can implement MVC in a WPF application, and how to create unit tests for the Model and Controller.

Materials & Handouts

The source code and presentation slides from this track will be distributed with the Code Code CD that each attendee receives.

Seating & Registration

Registration for the May Code Camp has opened.  You can register here:  Developers Guild Code Camp Registration

When you register, you can choose which track you would like to attend.  Choosing a track does not restrict you from attending a session on another track.

Selecting the track that you will attend most of your sessions in, will help organizers allocate seating space.

The WPF Business Application Track has been given a room that seats at least 75 developers. 


Code Camps are free to all attendees, including the food, drinks, facility, resource CD’s, printed materials and product give away’s.

This is why we appreciate our valuable sponsors so much.  They provide money, materials, products, time and personnel to enable Code Camps to be held.  Without our sponsors, these Code Camps would not happen.

The May Code Camp will have many sponsors.  I’ve been personally involved with three of our Code Camp sponsors and want to mention them here.

Infragistics      CrystalTechlogo



Infragistics is generously supplying resource DVD’s, data sheets.  For the give away portion of Code Camp they have sweetened the pie with Infragistics products and t-shirts.

Infragistics is also funding Josh Smith’s trip from New York City to Charlotte, NC so that Josh can teach in the WPF Business Application Track.

Josh is Mr. WPF.  His authoritative articles and blog is widely read in the WPF community.  Along with being a great friend has been my mentor for the last year.  We are blessed to have Josh Smith speaking at our Code Camp.


CrystalTech is generously donating financial resources to help fund the needs of the Code Camp as outlined above. 

CrystalTech is also funding Chandi Johnson’s trip from Arizona so that she could be on-site to personally assist developers and businesses understand the capabilities and wide ranging programs that CrystalTech offers those who require a hosting solution for their web sites or data.

I met Chandi at the recent Microsoft MIX08 conference and was very impressed by her knowledge of “real world” hosting requirements ranging from the small individual web site hosting, dedicated hosting, Share Point hosting up to an including data storage.

If you individually, your customers or business are looking for a hosting solution come and speak in person with Chandi and see how you, your customers or business can benefit from a CrystalTech solution.

Red Gate Software

Red Gate Software is generously donating t-shirts, product licenses and discounts to Code Camp attendees.

I’m still working out all the final details and will update this post when the ink is dry.

For the past few days I have enjoyed working with Red Gate putting this together.  I have been a long time SQL Compare customer of theirs and can only say from personal experience that they have first class products and tech support.  I recently purchased Ants Profiler to help with my WPF and LINQ programming and will give a real world demonstration of Ants during the Performance session.

I used Ants Profiler the other day to find where and why a LINQ to SQL query appeared to run slow the first time it was run.  You can read that post here: Reconciling Initial use of LINQ to SQL Datacontext

See You At Code Camp!

Have a great day!

Just a grain of sand on the worlds beaches.

WPF Business Application Series Part 3 of n – Business Object Declarative Programming; How To Implement Object Validation & Logging

April 1, 2008


First and foremost, please excuse my late delivery of this article and software.  I have been going non-stop learning, studying, testing and looking into code generation.

I have posted the third article in the WPF Business Application Series.  You can read Part 3 on Code Project here: Business Object Declarative Programming; How To Implement Object Validation & Logging.

This article covers in great detail declarative programming in the business layer.  This library allows for codeless validation of business object, codeless character text case correction and entity log entry creation.  The article has a Silverlight video that demonstrates the features of the UI.

The above image shows off a very cool feature of the software.  Notice that a binding exception is reported along with a broken validation rule in the business layer.  This reporting is achieved with no additional code on the developers part.  One of my goals was to have unified binding exception and validation rule violation reporting.  As you can see from the image this has been achieved and again, without any code.

The following are the bullet points of the BusinessEntityBase class that provides much of the functionality.

  • Shared and instance rule management, invocation and broken rule reporting. This includes multiple rule-set capabilities.
  • Error reporting at the property and object level. Errors can be extracted as either a string or generic list.
  • Is dirty tracking.
  • Very simplified method for setter’s to call that encapsulates the validation, event raising and property text case logic.
  • Audit message creation based on decorated properties. Message can be a string or collection of property name value pairs.
  • Message creation for the entire class. Message can be a string or collection of property name value pairs.
  • Change notification for all entity properties.
  • Changing notification for all entity properties.
  • Intelligent change notification for the IDataErrorInfo.Error property. This permits the Error property to be data bound and always be reported correctly in the UI.
  • Rich set of overridable methods that provide the deriving classes flexibility in programming business logic if required.

I have tried some innovative and in some cases original coding techniques (if that is even possible) to achieve the results I was looking for.

I hope that you can learn about using WPF for writing business applications from this series.

Have a great day!

Just a grain of sand on the worlds beaches.


Get every new post delivered to your Inbox.

Join 255 other followers