Archives for Technology

Quick Tip – Troubleshoot broken OData response using Notepad

Ran into a bit of an issue today when an application I developed stopped working. Fortunately I built a pretty awesome tracing framework that I often drop into all my applications that lets me get at important runtime information from within the application. In this case I was able to see the WCF Data Services query that was being sent. It looked fine. The problem was that the response couldn’t be deserialized.

Another multi-purpose value converter for WPF

Colin Eberhardt has posted a neat multi-purpose value converter that tries various conventional conversion methods to convert from one type to another. This overcomes a frustrating limitation in WPF/Silverlight data binding where the XAML parser is seemingly more intelligent at converting literal values to target types than values sourced from binding expressions. Unfortunately, the TypeConverter [...]

Very cool Visual Studio extension – VS10x Code Map

I have been using this Visual Studio extension called VS10x Code Map by Michael Kiss and I love it. It sits on the left or right of the Visual Studio text editor and provides an attractive outline view of the properties, methods, regions, etc in the current code file and lets you quickly navigate to [...]

Windows 7 Style "Aero" ChildWindow Template

Silverlight 3 introduced a very useful control called a ChildWindow. This is a “modal” dialog box that can contain whatever content you give it and it floats above the rest of the application inside a Popup control. I say “modal” because unlike ShowDialog in WPF or Windows Forms, showing a ChildWindow via the Show method returns immediately, but it does disable the application’s RootVisual which prevents the user from interacting with the rest of the application while the window is showing.

As cool as this control is, I have always been pretty disappointed in the default behavior and look and feel of the ChildWindow class. For example, the animation as it opens and closes is very unnatural and distracting. The overlay that “dims” the rest of the application successfully indicates the modal nature of the control, but it’s too strong I think. In fact I’m fine with just the normal “grey out” that happens when the RootVisual is disabled.

A while back I had created a pretty lame ChildWindow template that kinda sorta looked like a Windows 7 Aero window. It was a half-hearted attempt but it looked a lot better than the above. But then I saw a question on StackOverflow asking about creating an Aero glass style window and I decided to revisit the problem and try to come up with something decent.

SwitchConverter – A "switch statement" for XAML

Download the example project which includes the source for SwitchConverter and SwitchedContent. I figured I would write some more about value converters since I think there’s a lot of cool things you can do with them, especially when you put a little extra effort into generalizing them. One thing I find I need to do [...]

A multi-purpose NegateConverter for WPF/Silverlight

I came across a question on StackOverflow that is a very frequently asked question regarding data binding in XAML. Given a boolean, how do you bind the opposite value to the target? The answer of course is to use a value converter (a class implementing IValueConverter) and invert the boolean in code. I do this [...]

Download the Visual Studio 2010 Pro Power Tools

I saw in my feed reader a posting that announced the release of the Visual Studio 2010 Pro Power Tools extension that was available in the Visual Studio 2010 Extension Manager. At first glance I thought it was the Power Tools extension that I’ve been using for a while. However, this is a totally separate [...]

Never answer your phone, and other great productivity tips from Bob Parsons

I’ll be honest, this guy really grates on my nerves. Although my domains are registered with GoDaddy, I don’t even really like the company. I think their site is disgustingly bloated. The upsell is worse than a car dealership. And the tits and ass marketing makes absolutely no sense to me. But… I happened to [...]

Trick WCF Data Services into supporting $format = json

In the OData specification, the $format parameter can be passed on the query string of the request to tell the server that you would like the response to be serialized as JSON. Normally, to get JSON-formatted data, you have to specify "application/json" in your "Accept" header. The query string feature is handy in situations when [...]

Looks like my PowerShell got rusty…

This confused me for a minute. But once I realized what was going on I felt like a dolt. $Query = $UriBuilder.Query if ($Query.Length > 1) { $Query = $Query.Substring(1) + ‘&’ } $UriBuilder.Query = $Query + $KeyValuePair Access to the path ‘C:\Windows\system32\1′ is denied. At C:\Blah\Blah.psm1:366 char:32 + if ($Query.Length > <<<< 1) { [...]