Feeds:
Posts
Comments

Archive for October, 2007

The Document Outline has been part of Visual Studio IDE for a some time.  Web developers seem to be familiar with this window and use it frequently. I find that Winform developers are less likely know about it or use it. VS 2008 Document Outline has a few improvements over the VS 2005 version and in 2008 it works with the WPF designer too.  To show the Document Outline window click the (View\OtherWindows\Document Outline) menu. 

Features

You can work with the outline view whether viewing your WPF class in XAML view or Design view.  For today’s examples I’ll be working with the XAML view.  Once the outline window is open you can select an element in either the outline or your XAML doc.  Visual Studio synchronizes the two views.

Vs2008DocOutline1

There is a nice preview function that shows a element and all it’s children.  I find this much handier than the preview window built-in to the Property window.

Vs2008DocOutline2

Context menu

Right clicking a node in the outline view brings up a simple context menu with a few self explanatory items.  There is also a context menu for selecting the text in the XAML view.

Vs2008DocOutline3

 

Vs2008DocOutline4 

Vs2008DocOutline5

Vs2008DocOutline6

That’s about all there is for the Document Outline view.

Read Full Post »

Better WPF binding in .NET 3.5

.NET 3.5 is rapidly approaching.

Train Series

Sometime late this year, if everything goes as planned, NET 3.5 will be finished.  There is a handful of big changes in the next release  that will have a major impact on writing .NET code.  Of these I’d have to place LINQ at the head of the queue. But as is always the case with new releases from Microsoft there are little changes that don’t get a lot of press but turn out to be really useful.

WPF 3.0 shipped without an ErrorProvider control.   There was a mechanism for showing errors in the UI (write a custom ValidationRule class or use the lame ExceptionValidationRule class) but they weren’t very satisfying.    

.NET 2.0 had the wonderful IDataErrorInfo interface.  This was used by the WinForms binding engine and was useful for creating business classes that could notify the UI in times of trouble.

In .NET 3.5 we get to use IDataErrorInfo interface with WPF binding.  What’s that noise you hear?  It’s the happy sound of middle tier developer everywhere applauding this feature.  Seriously, this is great news.

Creating class

Below is a simple class that implements IDataErrorInfo.

image

Validating in XAML

Here’s a quick way to bind to the Product class.

 image

 

Update October 11. 2007

Rocky Lhotka has this to say about the new IDataErrorInfo binding.

A couple people have emailed me, asking what I think about this. My answer: I’m happy as can be!

-Walt Ritscher

RSS Like this article? Subscribe to the RSS feed.

Read Full Post »

I taught a WPF class at Microsoft in September.  During the Expression Blend demo I ran into this odd bug.

[Update November 19th, 2007] This has been fixed in the .NET 3.5 Release Version.

image

I thought it was my video driver or my DPI settings so last week I spent a couple fruitless hours trying to fix the problem.  No luck!

This week I’m teaching another  WPF class.  During the Blend lab all 20+ students had the exact same problem.  OK.  So now I know it’s probably not my drivers.   Spent some time researching and finally found a bug report at connect.microsoft.com.

Unfortunately, this is a bug in the Beta2 build of Visual Studio Orcas / .Net Framework 3.5. This has since been fixed, and you won’t observe this problem in the RTM build.

Apparently installing Visual Studio 2008 on my laptop caused the problem.  Good to know.

-Walt Ritscher

RSS Like this article? Subscribe to the RSS feed.

Read Full Post »