I get a lot of questions about how to do transparent top-level windows in Avalon, or nonrectangular windows, or layered windows, or other variations on the same theme. The short answer is you can do most of these things, but it’s really a Win32 feature rather than an Avalon feature, and you’ll do it using Win32 APIs. And some of this stuff works better on Longhorn, or at least will once we finish Longhorn. But the complete answer is quite a bit more involved…
First thing to know is that the only thing the window manager understands is a good old-fashioned Win32 HWND. So every Avalon Window object is an hwnd. And it has to play by the rules that hwnds play by – inside that hwnd, Avalon can do all sorts of crazy stuff, but when it comes to other hwnds on the desktop, Avalon has to play by Win32 rules.
In Win32, you can get a non-rectangular window two different ways. One is by using an region (HRGN) to describe the shape of the window. The other is to use layered windows (WS_EX_LAYERED), which allow you designate a certain color as being the “transparency key”, and Win32 will make any pixels of that color be completely transparent. So if you want a circular window, paint everything outside your circle with the transparency key color.
Layered windows also allow you to make the entire window translucent (semi-transparent) by specifying an alpha value to apply to every pixel in the window. (Win32 even supports per-pixel alpha, but this is very difficult to use in practical programs because in this mode you’ll need to draw any child hwnd yourself)
Avalon supports HRGN just fine in all its variations, we don’t provide any managed API for doing this but you can always use PInvoke and HwndSource and do it yourself. (Why not? Mostly as future proofing– we don’t want to bake HRGN and its limitations into the Avalon API, because one day we want to teach the window manager to go beyond hwnds and HRGNs)
Layered windows, on the other hand, come with some limitations, because Avalon is unlike your typical hwnd and uses DirectX rather than GDI to render. And here’s where it really gets complicated.
So to recap, in English:
As always, I'd appreciate your feedback so we can make sure we prioritize things appropriately. And if you can figure out how to explain this one better, please let me know -- this was a very long answer to a short question!