C# Windows Universal 10 TopMost Window

2019-03-05 17:55发布

问题:

I'm developing an Windows Universal 10 app.

Is there possible to set application as TopMost(always on top) ? like wpf or winform (TopMost property)

Thanks

回答1:

A feature called CompactOverlay mode was added in the Creators Update that supports this type of functionality. When an app window enters compact overlay mode it’ll be shown above other windows so it won’t get blocked. This allows users to continue to keep an eye on your app's content even when they are working with something else. The canonical example of an app taking advantage of this feature is a media player or a video chat app.

A blog post describing the feature can be found here

https://blogs.msdn.microsoft.com/universal-windows-app-model/2017/02/11/compactoverlay-mode-aka-picture-in-picture/



回答2:

Short answer is no, there is no way as of today to make the application modal.

There is a petition going around asking for this functionality, which was requested last December but given the amount of votes it got (35 at the time this answer was written), it doesn't look like it will be taken into consideration anytime soon.

As mentioned in the comments, this functionality would be PC only so even if it was added, my assumption would be that it wouldn't work outside of the PC mode (so no tablet, mobile or surface family device support).



回答3:

It's not possible UWP apps have some restrictions compared with WPF of Win32 apps(classic apps).

With uwp apps you need enable some capabilities to do something special in your app as you can see in the link uwp apps need ask for permission or they can't access or modify files directly.

https://msdn.microsoft.com/en-us/library/windows/apps/mt270968.aspx

Best Regards