Wednesday, 10 August 2011

Nice touch of humour in VirtualBox’s Clone Dialog

Oracle may have taken over Sun, and with it, the excellent VirtualBox. But it looks like the VirtualBox team, at least, have managed to retain their sense of humour.

image

Tuesday, 12 July 2011

How to create Inner Shadow Effects in WPF and Silverlight

A new experience for me this week: I was handed a Photoshop file containing the new UI design for the app I’m currently working on, and asked to implement it in WPF. Easy, I thought: Expression Blend has a Photoshop Import feature.

Not so fast!

Whilst Blend does a pretty good job of importing simple Photoshop files, it struggles when asked to convert the little flourishes with which designers like to top off their masterpieces. Like inner shadows.

Thus the inspiration for another first: my first ever Code Project article, Creating Inner Shadow Effects for WPF and Silverlight, which went live this afternoon.

image

If you’ve ever wanted to render something like this in WPF, go read the article.

Tuesday, 21 June 2011

WPF Training, anyone?

The team over at Framework Training approached me recently about putting together a training course for WPF and possibly UI Automation. I’ve been giving it some thought, but I need your help.

What would you like to see in a WPF course? Or perhaps, more to the point, what do you think your non-blog-reading colleagues would benefit from hearing about? Are there any areas you can think of that are not covered by existing courses?

I’m guessing that the world doesn’t need another WPF 101. But people might like some help on more advanced topics, such as using the MVVM pattern, extending the declarative powers of WPF with Triggers and Behaviors, or even learning how to write robust tests against their UI using the UIAutomation API.

So, over to you. The comment box is open … now!

And if you think the world doesn’t need another WPF training course, tell me what you would like to see. And feel free to give me the benefit of your wisdom on how training course in general should or should not be run.

Perhaps an incentive would help you put fingers to keyboard? I’ll give a £25 Amazon voucher to the person who (in my judgement) leaves the most helpful suggestions.

Update: My thanks (and, more concretely, a £25 gift voucher!) go to Jedrzej Sztompka who emailed in a copious list of suggestions. But don’t let that put you off: I’ll keep the offer open for anybody else who gets in touch with significant useful ideas.

Thursday, 16 June 2011

Resharper 6 XAML Tip: Intellisense for your Databindings

Anybody who has installed the Resharper 6 Beta (and that should be all of you – it’s awesome, and no major problems that I can see) will find in it a feature I’ve been wanting ever since WPF was first released: intellisense for databindings.

Mark up your Xaml so that Resharper knows the type of your DataContext and it will tell you what properties you can bind to, and warn you if it doesn’t recognize what you’ve typed. I’m always switching back and forth between my Views and ViewModels to make sure I get my property names right, so this will be a real time-saver.

There are lots of places where Resharper can already deduce the type of the DataContext – within DataTemplates where you’ve specified a DataType, for example. In other cases, there's just one thing you have to do to enable this awesome feature.

At the root of your file, you need to add the d:DataContext attribute and set it to the type of you Datacontext. Here’s an example:

<UserControl x:Class="MyApp.Views.MyView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:ViewModels="clr-namespace:MyApp.ViewModels"
             mc:Ignorable="d"
             d:DataContext="{d:DesignInstance ViewModels:MyViewModel, IsDesignTimeCreatable=False}">

Now if you press Ctrl-Space within a binding element, you’ll get lovely intellisense:

image