Is it possible to display a wpf window without an icon in the title bar?

前端 未结 6 1405
遥遥无期
遥遥无期 2021-01-01 10:23

As we all know, if the icon for a wpf window is undefined then the default icon is displayed. I want to display a window without any icon in the title bar. I realise that I

6条回答
  •  灰色年华
    2021-01-01 10:48

    No, this doesn't seem to be possible. Quoting from the documentation of the Icon property (emphasis mine):

    A WPF window always displays an icon. When one is not provided by setting Icon, WPF chooses an icon to display based on the following rules:

    1. Use the assembly icon, if specified.
    2. If the assembly icon is not specified, use the default Microsoft Windows icon.

    If you use Icon to specify a custom window icon, you can restore the default application icon by setting Icon to null.

    So, apparently a completely transparent icon seems to be your best bet here. Or perhaps hack around all this by using Windows API functions to set the appropriate style on the window. But this may interfere with WPF's window management.

提交回复
热议问题