0

For one of my apps I'd like to send the app to snapped view after tapping a button. As far as I know there's no public API available to send a running application to snapped view. Did anyone find a workaround to do this?

Somehow it should be possible since you're able to do it in Windows 8 itself, and snap one of the running apps.

enter image description here

Update: Being able to trigger a Win+. might do the same trick, but the SendKeys API isn't available in WinRT either.

Bart
  • 9,925
  • 7
  • 47
  • 64
  • 1
    possible duplicate of [How to snap app programmatically in windows 8 (javascript)?](http://stackoverflow.com/questions/10668721/how-to-snap-app-programmatically-in-windows-8-javascript) – N_A Aug 10 '12 at 18:22
  • 1
    From the link: "No there are no APIs for that. It is a user initiated action." This is applicable to ALL languages. – N_A Aug 10 '12 at 20:35
  • Found a workaround to fire Win+. to send the app to snapped, works like a charm. Gonna cook up a blog post on it later. – Bart Aug 10 '12 at 21:25

2 Answers2

7

There is no way to force an application into snapped mode - it has to be a user initiated action.

An application can request to be unsnapped through:

Windows.UI.ViewManagement.ApplicationView.TryUnsnap();

Which tries to push the app into fill mode.

Daniel Ballinger
  • 13,187
  • 11
  • 69
  • 96
Dominic Hopton
  • 7,262
  • 1
  • 22
  • 29
1

Windows 10 has a ApplicationView.TryResizeView method

So... to summarize the interesting WinRT journey:

Windows 8

Has a a 'Snapped' mode that a only a user can initiate. the developer can try to unsnap with the TryUnsnap method

Windows 8.1

Does not have Snapped mode, and TryUnsnap is deprecated. The dev can still listen for window size changes and know if the app view is in a smaller size as before.

Windows 10

Introduced the ApplicationView.TryResizeView method, where the dev can try to resize. Window size changed event is still there.

ApplicationView.GetForCurrentView().TryResizeView(new size(width, height)));
Community
  • 1
  • 1
Iris Classon
  • 5,752
  • 3
  • 33
  • 52
  • Nice summary Iris. You used to be able to trick it into snapped in 8 with triggering a key combination (I never came to write that post), but that broke in 8.1 as well. – Bart Sep 26 '15 at 23:49
  • I totally missed that, I'm surprised that was possible considering the sandboxing.I took a look at the supported Win32 and COM APIs for 8.1 and10 and couldn't see anything useful (in terms of key input) https://msdn.microsoft.com/en-us/library/windows/apps/dn424765.aspx – Iris Classon Sep 27 '15 at 00:07