WPF: Add the Always On Top menu item to the system menu

I have a monitoring tool where some, but not all users want it to always be displayed on top.

I would like to add this option to the system menu in the upper left corner. How should I do it?

+5
source share
1 answer

I would strongly suggest referencing this stream here in stackoverflow:

How to configure the system menu of a Windows form?

The above thread uses unmanaged C ++, but they wrapped it pretty well, it should still work adequately in WPF.

Then you just make sure that when you click on a special option, it switches the top property of the application:

bool tpMost = false;

This.Topmost = !tpMost; //Used to switch the bool value
+1

All Articles