2

It would appear that in a classic Windowstm application each control that is displayed (Button, ListBox, Menu, ...) gets it own Window (as in HWND).

Further, with Windows Forms (WinForms), while the controls no longer use the classic Window Classes, each control still has its own Window (HWND).

However, Windows (plural) that are created via WPF don't use separate Windows (pl.) for their controls. A button on a WPF dialog is not a separate Window (HWND).

Question

What consequences does this have for what we (as developers) can do or not do with a WPF Window plus it's controls vs. a "classic" dialog Window, where not only each control gets its own HWND, but even the Window Classes are well known (Button, #32770 (Dialog), ...)?

Community
  • 1
  • 1
Martin Ba
  • 37,187
  • 33
  • 183
  • 337

1 Answers1

6

This isn't new. Windowless controls were popular back in the days of ActiveX, VB6 featured them heavily. Browsers use them. Winforms has them too, the ToolStripItem classes are windowless. Component vendors like Telerik specialize in them. Clear advantages are being able to render faster, back-fill missing features, better support for custom styling and platform independence.

The consequences are the obvious ones. The UI tends to age quicker since it doesn't adapt itself to the evolving operating system look-and-feel. Usually quoted as an advantage. There tend to be slight glitches where the custom UI doesn't quite behave like the native one does. WPF does have a few. And UI Automation is more difficult, albeit well covered in WPF with the System.Windows.Automation namespace.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • *"The UI tends to age quicker since it doesn't adapt itself to the evolving operating system look-and-feel"* ... I'm wondering whether that's got anything to do with windowless. The WinForms controls, while using HWND, seem to have separate Classes, so they won't necessarily benefit from any OS redressing, or will they? – Martin Ba Apr 28 '13 at 10:34
  • Can you please clarify what you mean by "back-fill missing features"? Thanks. – Martin Ba Apr 28 '13 at 10:36
  • Oh, and by the way, for anyone wondering: [What is a windowless control?](http://stackoverflow.com/questions/2129107/what-is-a-windowless-control) – Martin Ba Apr 28 '13 at 10:36
  • 2
    A windowless control does all of its own rendering so by definition its look-and-feel is frozen in time. Very obvious from VB6 apps, you can recognize one from a hundred feet. Winforms control classes are managed wrappers around the native Windows controls, TextBox is still the Edit control from 1985. But doesn't look like 1985. One missing feature that WPF does well is transparency. – Hans Passant Apr 28 '13 at 10:54