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
Other titles I considered for this particular post were:
Reason 8. What!? no datagrid?
Reason 8. 1 reason why you should consider WPF for your existing desktop applications.
So let's get started.
What!? No datagrid?
It is a well-known fact that WPF doesn't ship with a built-in DataGrid. Actually, this fact is perhaps the most commonly cited reason that WPF is not suitable for Line Of Business applications. If you're a fan of the datagrid then there is no doubt that this could be a problem for you.
Personally, it wouldn't bother me in the slightest because I'm proud to state that I've never used a DataGrid in any of my Windows Forms applications. I think it's a pretty lazy way of building a UI and a usability sticking point.
So, ignoring my rant above (at your peril;), the omission of a DataGrid doesn't have to
rule out WPF.
Thanks to the wonders of the WindowsFormsHost there's nothing to stop you hosting a DataGrid directly inside your WPF application (if you still think you need a DataGrid given the Awesome ListView Control
provided in WPF, that is).
Title="Reason8" Height="350" Width="700" >
<my:WindowsFormsHost Name="_windowsFormsHost" >
<wf:DataGrid x:Name="_gridView" />
Here's the glorious hosted DataGrid in all it's glory.
It's even bound to my collection of books...
_gridView.DataSource = _books;
Why not have a play with the ClickOnce Reason 8 Sample
and see it for yourself.
Now is a good point to note that the DataGrid isn't the only omission from the WPF control. Others include:
These are all useful controls, especially in forms-over-data Line-of-Business applications so you really do need to think carefully before jumping on the WPF express instead of Windows Forms. This reinforces my notes of caution in the introductory post to this series: 10 reasons to consider WPF for your next desktop application
Of course, you could plug these wholes with third party controls or even write them yourself - but that's precious project time lost.
Does it work the other way around?
Yes, there's a reason I considered calling this post: "1 reason why you should consider WPF for your existing desktop applications"
: You can host WPF inside of Windows Forms using the ElementHost control:
... and a screenshot to prove it:
Enough interop options to shake at a monkey's armpit.
20 Nov 2007
» Next Post:
Powershell to test your Regexes
« Previous Post:
Silverlight to get full WPF databinding honors
Comments are closed for this post.
21 Nov 2007
Great list of reasons. I am really enjoying the series. Reason 8 is still a big deal for me. I am surprised we are not seeing more controls being released. Do you have any idea when these missing controls might make an appearance?
Looking forward to 9 and 10.
22 Nov 2007
There are a number of third party offerings (some are even offering a free datagrid for WPF!) that can fill these gaps.
Failing that, I guess you'll probably be waiting at least until vNext of WPF but I don't know for sure.
01 Dec 2008
Al @ 21 - you might want to look at Microsoft's own offerings here:http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14963