I have a monitoring tool where some, but not all, users want it to be displayed always on top.
I would like to add this option to the sys开发者_如何学JAVAtem menu in the upper-left corner. How would I do that?
I would strongly suggest referring to this thread here at stackoverflow:
How can I customize the system menu of a Windows Form?
The above thread utilises unmanaged C++ but they have wrapped it quite well, it should still work adequately in WPF.
Then you would simply ensure that when the custom option was pressed it toggles the topmost property of the application:
bool tpMost = false;
This.Topmost = !tpMost; //Used to switch the bool value
精彩评论