Home > View Post

Reason Number 1. Rich Content Model

Earlier I introduced a series of posts entitled 10 reasons to consider WPF for your next desktop application. If you haven't read the intro yet, better head on back and read it first.

For sometime web developers have become accustomed to easily creating the content they want to see using HTML but this power has been out of reach for WinForms developers. For example:

Want a button with some different types of formatted text? No can do. Want a tooltip to have a picture inside? No can do*.

With WPF this is about as easy as it gets.

Reason 1: Rich Content Model

        <StackPanel Orientation="Horizontal">
            <Image Source="/bruusi.jpg" Margin="3"/>
                <Run FontWeight="Bold">Tooltips</Run>
                What about tooltips with pictures and formatting!
    <TextBlock>Look a <Run FontWeight="Bold">button</Run> with
    <Run FontStyle="Oblique">formatting!</TextBlock>

A simple example but hopefully it indicates just how dramatically easy it is to do this in WPF and allows you to see some of the possibilities. The world really is your lobster. Furthermore, every piece of this could have been sourced using WPF's powerful databinding - more to come on that later.

Wanna see this sample in action? Try it here: Reason 1: ClickOnce Sample.

PS - I will make the full source available for all the examples at the end of the series.

* - One for nitpicker's corner. I realise that it is *possible* to do this in Windows Forms, but it is also pretty tough!

Tags: WPF

Josh Post By Josh Twist
4:22 AM
11 Oct 2007

» Next Post: Reason Number 2. Databinding
« Previous Post: 10 reasons you should consider WPF for your next desktop application

Comments are closed for this post.

Posted by Peter W @ 31 Oct 2007 9:05 AM
These are some great articles, and Im still beginning to grok the XAML behaviors and structures; it is more intuitive experience than I have been trained to expect from microsoft ;).

Im a little lost on the clickonce downloadables you have been posting. The file arrives as ReasonX.application, but when I try to execute this file, I get an error stating the required file ReasonX.manifest was not found.

I am assuming I am missing a library, but I have VS 2008 and the .NET 3.5 runtime. Does any of this ring a bell to you?

Posted by Josh @ 18 Nov 2007 2:34 AM
Hi Peter,

Sorry I missed your comment for so long. No - this doesn't ring a bell for me. Everybody that I know that has tried this has had no problems with it.

What version of VS2008 and .NET 3.5 do you have? Beta 2?

Posted by Simon @ 14 Oct 2008 1:47 PM

I had the same error, when I was using Firefox. Worked fine using IE7

Posted by Ramesh @ 19 Apr 2010 6:15 AM
Hi Josh,
Thanks for the great article. I have a existing windows application. I would like to embed the WPF richness to my winforms(at least to the login form). Could you suggest me how I can attach the WPF to the existing application. Thanks in advance.


© 2005 - 2021 Josh Twist - All Rights Reserved.