Displaying a PDF file within a WPF application

I had a need to view PDF files directly within a WPF application and Stackoverflow and Google did not provide much assistance, so I set out on my own to see what I could create.  It turns out, it is not that difficult.  The trick is to use the WinForms support in WPF ala the WindowsFormHost control.  The application is so simple, I built it start to finish in under 5 minutes and captured it in a screencast for you to check out.

WPF PDF viewer app

Read the rest of this entry »

Posted in .NET, Code, WPF. 25 Comments »

WPF MVVM Video by Jason Dolinger

I just happened upon a video put together by Jason Dolinger on the WPF MVVM (Model View ViewModel) pattern, which I found to be excellent.  In this 1.5 hour video he refactors a simple application using the pattern and does a great job describing the benefits as he goes along.  It is also interesting to see his use of Unity as well.  Here is a direct link to the video:

http://www.lab49.com/files/videos/Jason%20Dolinger%20MVVM.wmv

And here’s a link to a blog post about it with a link to the source code:

http://blog.lab49.com/archives/2650

Enjoy!

Posted in .NET, MVVM, WPF. 2 Comments »

Intro to WPF MVVM

Last week, I gave a presentation at the Madison .NET User Group on an introduction to the up-and-coming Model-View-View Model (MVVM) pattern for WPF.

mvvm-overview

In the presentation, we made a very simple application that used the MVVM pattern.  I’ve posted the source code to this quick and dirty app here.  Note: this app takes several shortcuts and shouldn’t be used as an example of best practices, but we did build it in about 30 minutes.  :)

Read the rest of this entry »

Getting Started in WPF with IValueConverter

For those of you looking to learn or hone your fundamental WPF skills, I thought you might find this video beneficial.  It’s a nice 11-12 minute video on what you can do with IValueConverter by the lovely Beth Massi.   The video goes through an example of IValueConverter in VB.NET, but they also have some C# code to download if you like.  Check it out:

http://msdn.microsoft.com/en-us/vbasic/dd367843.aspx

The IValueConverter interface is very handy when you want to convert or format a given object to your specifications, and in Beth’s example she also displays how you can use it to verify and do type validation of user edited data.