I have been looking at making my own window frame in WPF, similar to Visual Studio. I have read that setting AllowsTransparency = true
would force WPF to render in software-mode. This example is the source of my confusion (emphasis mine), which states:
Complete customization of WPF window can be done only when AllowsTransparency is set to "True", which causes that the window is software rendered which might be not as fast GPU rendering.
However, I've read elsewhere that with window layering you can have hardware-acceleration and this is what WPF does. I also find it hard to imagine that Visual Studio 2013 -with its custom frame and transparent border blur- would be software-rendered.
Is there a definitive answer to the question (assuming Windows 7 onwards), Is WPF Hardware-accelerated when Window AllowsTransparency
is true?
It seems that transparent windows (AllowsTransparency = true
) are hardware accelerated for Windows Vista and upper: HW Acceleration of Layered Windows
There is also an hotfix to make it work under windows XP as well: http://support.microsoft.com/kb/937106/en-us
I'll add my two cents too.
Yes, it's true. From Vista onwards, we have hardware acceleration for layered windows, and there seems to be a hotfix for XP aswell.
This is where the good news stop.
Don't try and use AllowsTransparency - trust me, there's just so much that can and WILL go wrong, despite it being hardware accelerated. Ofcourse, think about your use case: if it's simple hobby project, not an enterprise level application, then, go ahead.
Some of the problems I've personally experienced:
This guy seems to be even talking that software rendering is sometimes faster than hardware, for layered windows, which I kind of agree. My experience has also shown that "hardware acceleration" is nothing spectacular on WPF.
I remember switching to software rendering, and saw no performance loss. In fact, I suggest to disable hardware rendering because it's complex, and it causes visual bugs, if you're targeting wide area of different configurations (XP, XP64, Vista, Win7, different video cards) - famous black spots.
By the way, VS2010 SP1 disables hardware rendering for visual studio on XP, even if it supports it. Why? "A significant number of crash reports stemming from the hardware acceleration"
That said, Visual Studio2013 does not use AllowsTransparency - correct me if I am wrong, but Snoop revealed that the main window has AllowsTransparency set false.
How can you have a custom chrome window, that is not layered & PERFORMS well? This is quite complex subject, but you can get started if you google for "WPF Custom Chrome library". I suspect VS does something similiar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With