wpfcitrixxenapp

How to prevent WPF+win32 app taskbar icon from changing to Citrix default icon when run in Citrix?


I have a WPF application with lots of native code and win32 windows. Program's Application's icon is defined in VS2015 project as ..\gui\rc\MyApp.ico. When I start program in XenApp Citrix:

  1. Splash appears
  2. WPF Login window appears with correct App icon in taskbar
  3. After login a splash appears again and taskbar icon disappear
  4. Next a win32 window appears with a taskbar icon.
  5. While loading large amount of data, the taskbar icon is Citrix-icon, but when ready the correct app icon is switched back
  6. After closing win32 dialog the mainwindow appears with Citrix-icon in taskbar.

The win32-dialog (steps 4-5) before mainwindow can be skipped resulting mainwindow to be opened after splash with Citrix taskbar icon. Steps are above only because while dialog is loading taskbar icon is Citrix.

MyApp.ico is 160x160 pixels with 32 bit depth.

When mainwindow is created during initialization its ShowInTaskbar is set to false. When it is ready it is set to true. This is done because we want to show other window(s) before mainwindow so unfinished mainwindow is somewhere outside the screen(s) and we don't want it to be accessible from taskbar.

EDIT: This does not happen if ShowInTaskbar is not set to false.


Solution

  • Not actually a generic solution for this problem, but it seems that my proposed simple way solves this particular issue with the OP's code.

    Rather than setting the ShownInTaskbar property, it is enough to initially set the Visibility property of the main form to the Visibility.Hidden value.

    As soon as the window is ready, the Visibility property can be set to the Visibility.Visible value causing the window and its task bar button to be displayed (with the correct icons).