What is Toluu?
Toluu is a free service for sharing the feeds you read and discovering new ones.
Get Invite

LearnWPF.com - Goodbye battleship-grey

LearnWPF.com - Goodbye battleship-grey


WPF-specific Snippets in Visual Studio 2008November 30 2007

Visual Studio 2008 comes with some useful snippets for WPF development out of the box. In C# type propa followed by two TAB keystrokes inserts the a snippet for an attached dependency property, including a getter, setter and the registration code.

Similarly propdp followed by two TAB keystrokes inserts a snippet for a dependency property. As you would expect the snippet for this is very similar to the attached dependency property, except in this case it calls DependencyProperty.Register() instead of DependencyProperty.RegisterAttached().

The C# snippet in action

Visual Basic in Visual Studio 2008 has even more snippets defined including RoutedCommand and RoutedEvent registration snippets, and a RoutedCommand handler snippet. I'm primarily a C# kind of guy, so I never realized that VB.NET had the two snippets I mentioned above for C# in VS2005 (with the VS Extensions for .NET 3.0 installed). It seems in this case C# is playing catch-up to VB.NET.

You can look at all the snippets (not just the WPF-specific ones) by selecting "Tools->Code Snippet Manager" from the VS menu. You can of course define your own snippets, but it is nice to see these ones built in to VS2008.

Visual Studio 2008 and .NET Framework 3.5 ReleasedNovember 25 2007

Visual Studio 2008 and .NET Framework 3.5 were released earlier this week. Visual Studio 2008 is the first version of Visual Studio released since WPF and the rest of .NET Framework 3.0 were released a year ago. VS2008 includes a WPF designer and XAML editor, and allows targeting of .NET 3.0 or .NET 3.5 when developing and compiling solutions.

.NET Framework 3.5 includes a host of new language features for C# 3.0 and VB9. Most of these language features exist primarily to support LINQ, however .NET 3.5 also includes some enhancements to WPF. An overview of the changes in 3.5 can be found here on MSDN. Kevin Moore also recorded an interview for Channel9 before he left Microsoft discussing some of the changes that were coming in 3.5. Dr Tim Sneath also listed off 15 of his favourite enhancements to WPF here.

Some of my favourite enhancements for WPF in .NET 3.5 are supporting XBAP applications in FireFox (on versions of Windows) and the data binding and IErrorProvider enhancements (thanks in part to

How can I Change the Size and Color of the Stylus Input in the InkCanvas?October 23 2007

WPF’s InkCanvas control provides a quick and easy way to add ink input to your application. By default the strokes in the InkCanvas are thin black lines, which may be too thin or difficult to see in some instances. Fortunately the appearance of the strokes can easily be changed by modifying the DefaultDrawingAttributes property of the InkCanvas which is of type DrawingAttributes.

<InkCanvas>
  <InkCanvas.DefaultDrawingAttributes>
    <DrawingAttributes Color="Red" Width="5" />
  </InkCanvas.DefaultDrawingAttributes>
</InkCanvas>
red inkcanvas strokes in a smiley face

The DrawingAttributes has a number of other interesting properties, such as the FitToCurve property which makes lines drawn in the canvas smoother. It is set to false by default. This property seems to have less of an effect when using a tablet input device. When “drawing” with the mouse you can notice the difference more easily.
InkCanvas elements with different fittocurve settings


Setting the IsHighlighter property to true causes the strokes to be drawn semi-transparently to allow content behind them to show through.








Free Vector Images for your WPF ProjectsSeptember 12 2007

If you're from further down the developer end of the designer-developer spectrum chances are you've been avoiding creating your own images, and on the look-out for some good XAML icons and vector images to include in your application, since bitmap images often look blurry. While we included some XAML image resources in the past there are plenty of other good resources out on the web if you know what to look for. Although no graphic designers are sitting at home churning out XAML code per-se, there are plenty of ways to convert the vector content they produce (like SVG files or Adobe Illustrator .ai files) to XAML.  Here we've included two sites to get you started, and approaches for converting other vector formats into XAML.

OpenClipArt.org is a repository of "open source" vector art stored in SVG format. SVG is an XML-based vector format (and thus you could transform it yourself to XAML if you wished), however there is already an excellent tool from Andrej Benedik from WPF-graphics.com for doing this. You can also use the free and open-source InkScape editor to edit SVG files. Ma

Real-World WPF Start Time Perf Tip - Delay Setting the DataContextSeptember 4 2007

.NET applications traditionally suffer from slower startup time than native applications, caused by the time to load the .NET framework DLLs, JIT time etc. WPF applications have further things that can slow down cold start-time, the extra PresentationCore, PresentationFramework and WindowBase assemblies that need to be loaded and the start-up of the PresentationFontCache service. Any tips to help improve start time is therefore most welcome.

Doug Stockwell recently released an updated version (v1.6 build 2802) of his free RikReader WPF-based RSS Reader, with considerably-improved start time. I've been using RikReader as my primary RSS reader since it was first released, and in previous versions the start time stood out as a blemish on an otherwise excellent app. The performance characteristics of older versions of RikReader were a little different to usual applications, in that the hot start-times were still quite bad (>10 seconds for my list of a couple of hundred feeds), whereas the new version hot-starts in about 4 seconds (roughly equivalent to Expression Blend, Thoughtex and most other WPF applications I use). Cold start-times for RikReader had also improved noticeably.