Even a chimp can write code

Friday, May 26, 2006

Theme support in Windows Presentation Foundation

Question: I want to create a custom Windows Presentation Foundation button whose look and feel depends on the Windows desktop theme currently in use. How do I get notified when the user changes the theme?

Neil Kronlage provided this answer:
The WPF theme engine will switch styles automatically for you if you place them in separate ResourceDictionary XAML files compiled in your application.

The files need to be named


for example, these are the themes that Microsoft produces:


The case for classic is slightly different:


Windows Presentation Foundation does not provide an event when the theme changes. If you need to go beyond what is provided by styles in a resource dictionary, you will need to listen to the WM_THEMECHANGE message in a window hook.


Email this | Bookmark this

Tuesday, May 23, 2006

Big day at work: Beta 2 is out the door!

Today was a big day for so many Microsofties. Beta 2 of just about everything went out the door today. Get Windows Vista, WinFX and Windows SDK. Or get Office 2007 Beta 2. Or Expression Graphic Designer. Or Expression Interactive Designer. The latter two are CTPs.

I can't wait to geek out with my colleagues at the Beta 2 Party tomorrow.

Tags: , , ,

Email this | Bookmark this

Sunday, May 21, 2006

Sometimes even Slashdot doesn't get it right

I came across an old iPod review on Slashdot dating back to October 2001 (via Niall Kennedy). A cursory glance at the collective wisdom of this crowd led me to believe the iPod had no real chance of being successful. Perhaps folks at Apple should have read this and just given up in 2001.

Email this | Bookmark this

Live Scores with MSN Search

This was a nice surprise. Click to see larger image: Live scores with MSN Search
Ashley and I were watching the Mariners play the Padres on TV and she suggested we go to the ballpark to catch a game. With visions of hot-dogs and garlic fries, I fired up IE7 and typed "seattle mariners" in the search bar. Lo and behold, MSN Search comes back with this... the current scores from the game! And accurate, to boot.

This is one of the many areas Live.com search needs to catch up. This is also partly why MSN Search is still my default search engine.

Tags: , ,

Email this | Bookmark this

Application and Content options with WPF

I'll attempt to provide an overview of the application and content options available with Windows Presentation Foundation. Perhaps that will clear some of the confusion and ambiguity, and help you make decisions. This is a cross-post to my response in the WPF Forum.

Application or content in WPF can be architected to fit into one of the following segments:

  • Loose or Uncompiled XAML

  • Browser-hosted applications (XBAPs)

  • XPS documents

  • Standalone, window-based applications (SAAs)

Loose XAML has the advantages of simplicity and is suitable for small islands of rich data or vector graphics, and sometimes even as standalone pages with low interactivity. Loose XAML is especially good for represent flow documents. However, no script or code-behind support is currently available in concert with loose XAML. Allows for seamless integration with existing web content: you can seamlessly navigate to a loose XAML file from HTML and back.

XBAPs run in a partial trust sandbox within the browser and aim to offer parity in features (I'd argue it achieves it more or less) with traditional web applications. This is suitable for building rich web applications. Currently XBAPs only work on browsers that support the Web Browser control (IE6/7, Netscape, MSN Explorer, Maxthon etc.). I know people have written WebOC plug-ins for Firefox, Opera etc. (e.g. Neptune, IETab etc) but I haven't played with these enough. XBAPs throw no prompts on launch and therefore they too allow for seamless integration with existing web content.

XPS documents are paginated representations of electronic paper. The doc format is open and cross-platform. Ideal for creating, sharing, printing and archiving documents. XPS provides support for a subset of XAML functionality. They may be viewed inside the browser akin to XBAPs, or in another viewer (say 3rd party) if one is registered.

Standalone, window-based WPF applications have the same deployment model of ClickOnce full trust applications (i.e. Start menu and Add/Remove Programs integration, update support etc.). These applications are installed per-user on your computer and you can tap into the complete power of Windows Presentation Foundation with these applications.

Besides these, there is:
  • Windows Presentation Foundation/Everywhere (WPF/E)

This is a parallel initiative that takes much of WPF's functionality and richness, and makes that available cross-platform and on devices. WPF/E provides support for two complimentary programming models: the .NET model and the JavaScript model. This allows you to leverage your existing investments and skills in either areas and provides for a powerful interaction with the browser DOM among other things.


Email this | Bookmark this

Friday, May 19, 2006

Passing URL parameters to a WPF browser application

A colleague asked:
I have a task on my plate to change the StartURI for our app based on query parameters to the xbap app. Is that possible?

We have one app (which combines Foo and Bar), but when users launch "myapp.xbap?view=Bar", I’d like to show a different initial UI.

[ed: minor edits made to the quote above to remove specificity]

So, can you pass in URL parameters to a WPF browser application (.XBAP)? Sure you can. However, only if the XBAP is deployed over HTTP. You cannot launch an app from a UNC share and expect to pass it HTTP request parameters.

Here's how: You need to specify <TrustUrlParameters>true</TrustUrlParameters> in the project file and use System.Deployment.Application.ApplicationDeployment.CurrentDeployment.ActivationUri property to get to the URL and pull the request parameters from it.

This functionality will not be available when you run the app within Visual Studio (i.e. hitting F5 or Ctrl-F5) because WPF applications launched from within Visual Studio are not ClickOnce-deployed.


Email this | Bookmark this

Tuesday, May 16, 2006

Microsoft's acquisitions and the VC Summit

Don Dodge on Microsoft's acquisitions and the recent VC Summit:

[...] The acquisitions cover a range of technology areas, and typically fill in holes in our product roadmap. About a third of the companies acquired were not yet VC funded. We are doing our best to identify great engineering teams and unique technology early in the process. We form partnerships, help them get started with Microsoft, introduce them to VCs, and sometimes that results in an early acquisition. That is not the ultimate goal...but sometimes it happens. Onfolio is a good example of an early partnership that resulted in an acquisition.

Acquisitions are typically made for three reasons;

People - acquiring great engineering teams and operating managers
Technology - adding a technology to an existing product set
Time to market - sometimes the market moves faster than Microsoft can release a product. Security is an example. Sometimes legislation changes the market too quickly. Sarbanes-Oxley introduced new requirements for compliance, so acquisitions were made to respond.
New Markets - Great Plains allowed Microsoft to enter a completely new market. Teleo got us deeper into the VoIP space.

Read his full post.

Tags: , ,

Email this | Bookmark this

Sunday, May 07, 2006

Design in haste, repent in leisure

Dave Relyea threw in this pearl of wisdom in one of his emails (I can't talk about the subject just yet).

Email this | Bookmark this

The hReview microformat on Yahoo! Tech

Via Alex Moskalyuk: the new Yahoo! Tech site uses the hReview microformat. Neato!

Email this | Bookmark this

Thursday, May 04, 2006

The Mad Finn as a pro gamer

Tero is among the top 64 qualifiers from North America in the Project Gotham Racing 3 worldwide tournament!

When I first added Tero to my friends list on XBOX Live, I looked at his profile. I'm a newbie to gaming and this was just a few days after I'd bought my console. So imagine my contempt for the guy when I slide in my shiny new PGR3 DVD - intent on playing the Steel level - and see that he'd already won tournaments at Gold level. No surprise that I've never asked to play him on XBOX Live. That'd be like challenging Mika Häkkinen to a drag race.

I'll be rooting for him this time though.

Email this | Bookmark this

Monday, May 01, 2006

The New York Times news reader on WPF

Several folks on the team have been working with the NYT folks on a skunkworks project that was officially announced recently. I guess that means we're free to talk about it now. See remarks by Bill Gates at the American Society of Newspapers 2006 Convention.

Jeff has a series of posts on this starting with The New New York Times.

I don't think the screenshots handed out to the press do justice to the application. While I have slightly old bits of the app on my machine, I plan to upgrade and hopefully post some screenshots shortly. Jeff tells me there's a Channel 9 video in the works.


Email this | Bookmark this