WPF Samples Project

Jun 10, 2008 at 10:15 AM
I've started a google code project here at Composite WPF samples with the goal of sharing sample applications. There's source code up along with a binary for you to see what the project does, at the moment the actual project itself doesn't do a lot but it does give some examples on how to use Composite WPF. This link shows a screen shot of what the sample application looks like, I'm no designer so it's a bit rough, but that's where the design team are meant to come in right? :)

I hope this at least helps one person, better still, I'd like comments on what I've done. If you want to contribute to the existing sample or create your own sample app under this umbrella just let me know, the more we get communicating ideas and samples we collect the better all our products will become.

Internally here we're using CVS which is where I initially created the project, I just need to strip out the CVS components before loading in to the project.

Jun 10, 2008 at 10:41 AM
Edited Jun 10, 2008 at 10:42 AM
Hello people, I've added my companies sample to the SVN repository on the project

    svn checkout http://cwpfsamples.googlecode.com/svn/trunk/ cwpfsamples-read-only

If you want to help out please by all means let me know.

Jun 10, 2008 at 5:53 PM
I checked out your project.  It basically looks like the way I am/was heading.  However, after studying the ViewModelCompositionSpike I finally "get it" when it comes to DataTemplates.  For example, in your app, take the LinePlanEditorModel class.  I would create a DataTemplate for that class (essentially move the XAML from LinePlanEditor).  Then you can remove the view and DataContext code from the constructor.  This creates a true separation of code and presentation.  Wherever you display the view in a region display the LinePlanEditorModel instance and not the instance.view (since it's now gone).  The clr will grab the DataTemplate and use it for display.

I don't know if it's possible to use DataTemplates in every situation but I've found that it actually reduces the amount of code and makes the app easier to understand.  My .02.
Jun 10, 2008 at 6:18 PM

Thanks for the tip, I need to study a bit more but what your saying does sound like a good approach, to tell you the truth I've been getting lost in the Stock Trader RI project, it's a complex piece of work that I've found instead of learning what's going on I'm fumbling about missunderstanding a lot of the concepts being used.

I'll check out the ViewModelCompositionSpike once again and see if I can do what you're suggesting.

I'm thinking of creating a basic sample project that may take some real world use-cases for the samples project, maybe something simple like a recipe database or something.

I've gotta get to bed, it's 3:17am here in Aus, but I'll see what I can do tomorrow evening, I didn't get much done tonight, was again reading the Stock Trader RI tonight.

Thanks so much for taking the time to check out my solution,
Jun 10, 2008 at 7:58 PM
Oh frig, this is the second time I have to write this, screen just refreshed and I lost the post.


Okay, I finally get all this DataTemplate thing *pats self on back*. After studying the spike sample and following your guidance I've now got it working on the LinePlanEditor as you described. I'll soon finish this on the rest of the views and submit them to SVN for everyone to see. I love this, though there is one problem I haven't quite figured out yet, for views where there is a Content Control (like a ListView) where an "Activate" action needs to envoke a command, how do you perform this sort of action? Or any event invokation for any UI component? I haven't gotten to the events bits of Prism yet so maybe this is where it's all done?

Okay, now 5am and I gotta get up in a couple of hours for work,

Jun 12, 2008 at 8:44 PM
I'm creating a new app in my samples project called "LateNight" I don't know what the app's use-cases will be just yet, but it's going to be a reiteration of ProductPrism with all refs to my company removed and I'm writing a script document that anyone can use to reproduce the solution,  this should help me document how to create a sample project in the future.

Hope this is handy for someone.
Jun 12, 2008 at 8:47 PM
Forgot to mention, I'm using the new Microsoft.Practices.Composite libraries. Can anyone tell me what CAL means? Composite Application Library?

Jun 12, 2008 at 9:06 PM


Nice job! You may want to consider putting this in the Prism Contrib project. Thanks for your effort!

Jun 13, 2008 at 4:23 AM

Thankyou gblock, For sure I don't see why that would be a bad thing at all. I'll post on the prism-contrib page soon.

Jun 16, 2008 at 8:24 PM
Edited Jun 16, 2008 at 8:26 PM
New sample up on project page Late Night. This project stems from the Product Prism project and has the following new features
  • A new login screen that demonstrates how one might implement a login screen. Use admin for the username and pass for the password when the application starts up (this is written on the dialog itself).
  • A new splash screen demonstrating how one might show a borderless window with a progress bar and message text while the application starts. I haven't perfected this yet as I need a way for modules to register messages as they are starting up, the problem I'm facing is that modules must be started on the UI thread which is not practicle for sending messages to this dialog.
  • An about screen that can be found from Help>About which demonstrates presenting IModule data for modules found from the applications IModuleEnumerator. I'd like to extend this further by getting some of the assembly information which could be useful in order to show the assembly version and an icon if it exists.
  • Document model has been enhanced to provide feedback via events for opening/closing documents, a cancellable event can be used while closing a document which will abandon a close operation.
  • Any System.Windows.FrameworkElement object can be used for a document view, it no longer needs to be a System.Windows.Controls.UserControl.
  • Tabs now have a close button with functionality that reflects the IE7 tabbed browsing mechanism.
Please provide your feedback as it's much appreciated.

Oct 15, 2008 at 12:00 PM

Hi Brett,

Thanks for gr8 information.

But as of now am facing small problem with the code shared in the above link.

Problem Description: ProgressBar in the splash screen donot get updated, even if it's "IsIndeterminate" property is set to true. Am not able to show any animation in the splash screen.
Am running this on XP machine.

Please suggest me how to handle this issue.