WPF orientation on Windows Surface - c#

We have a C# WPF application that works great across every Windows tablet we have tested with except for the Microsoft Surface. Our app is specifically set to only run in portrait mode, for example, and yet when you run the app on a Surface the orientation rotates based on the orientation of the device.
No other device behaves this way. Its as if the Surface overrides any orientation settings that are set in the app and decides for itself what orientation to use.
Is there a way to prevent this?

Related

WPF Issues Creating Window on Secondary Screen Only On Certain Hardware Configurations

I'm using the standard recommendation for creating a Window and having it display on a secondary monitor:
I use the following to get the screens available:
Screen[] availableScreens = Screen.AllScreens;
Extract the working area of the target screen (second screen in my case, not the primary screen):
secondaryScreenWorkingArea = availableScreens[1].WorkingArea;
When creating the window, set the location properties based on the working area (before calling Show()):
Left = secondaryScreenWorkingArea.Left;
Top = secondaryScreenWorkingArea.Top;
Width = secondaryScreenWorkingArea.Width;
Height = secondaryScreenWorkingArea.Height;
Some other things to note about the window:
It is a fullscreen window that is intended to span the entire second
display
It is not the main application window
It is hidden from the taskbar, it is intended to be supplemental to
the main application window
WindowState = WindowState.Maximized;
ShowInTaskbar="False"
WindowStyle = WindowStyle.None;
Running on Windows 10 Enterprise V 1809
Below is a rundown is different configurations that I've tested, and only one of them is not behaving correctly:
When I run this on a workstation setup with two 1920x1080 displays, 100% display scaling, it works as expected.
When I run this on a workstation setup with two 1920x1080 displays, 150% display scaling, it works as expected.
When I run this on a workstation setup with a 1920x1080 display and a secondary USB display (800x480) connected, 100% display scaling, it works
When I run this on a workstation setup with a 1920x1080 display and a secondary USB display (800x480) connected, 150% display scaling, it works
When I run this on a Microsoft Surface Go with the main surface display (1800x1200) and a secondary USB display (800x480) connected to the surface dock, 100% display scaling, it works
When I run this on a Microsoft Surface Go with the main surface display (1800x1200) and a secondary USB display (800x480) connected to the surface dock, 150% display scaling, it DOES NOT work. Instead, once Window.Show() is called, this is triggering the window to relocate to the primary display (The surface go screen). I noticed this because I am receiving a LocationChanged event for the window during my call to Window.Show() and see the Width and Height properties have updated to the sizing of the Surface Go display (1800x1200). But, curiously, the Top and Left properties are NOT updated even though the window has moved.
As you can see from the cases above, it seems to be an issue with Display scaling + the Surface Go. On my workstation, I forced the same resolution as the Surface go (1800x1200) and set display scaling to 150%, but could not replicate the issue from the Surface Go
Furthermore, I performed some testing with another USB display with a slightly higher resolution (1024x600) and have noticed that the same issue occurs, only on the Surface Go, but this time it required me pushing the display scaling to 200% before the issue began to occur in that configuration.
Several things I've tried, but none produced any solutions to this issue:
Tried various configurations of dpiAware and dpiAwareness. These changed the scaling of the coordinates I received when grabbing the AvailableScreens, but using scaled/unscaled coordinates had not affect on this issue
Restarting the Surface Go after changing the display scaling option (per the "Some apps won't respond to scaling changes until you sign of" message displayed in the Display Settings
Tried setting WindowState = WindowState.Maximized both before and after the Loaded event and both yielded the same result.
Any help or other ideas for things to try would be appreciated, not sure if this is a WPF, Windows 10 or a Microsoft Surface Go issue.

How do you set Windows CE 6.5 to landscape only using C#?

I am writing an application for Windows CE 6.5 in C#. The device will be mounted on a wrist strap so will always be in the landscape position, so I have designed the app accordingly. The problem is when you move the device when working the device switches between Portrait and Landscape. This is quite annoying and will also defeat the purpose of the program as it will slow down the users if they have to wait for the device to switch to landscape every time they want to use it.
I have researched this but have not found a working solution. I know in previous versions of CE you can set Right Handed/ Left Handed Landscape but I have checked and that option is nowhere to be found on this device.
Is there any way of programatically setting the orientation so that it does not change?
Thanks In Advance

How to modifying already designed metro style app to support all screen resolutions?

I'm new to app developed and in my first attempt i tried to design a win8 metro style app. During whole design process i took default screen resolution of 1336X768 and never tested my app in other resolutions.After completing whole development process, now when i change resolution of the simulator and run the app the results are shocking!!!, few buttons are going out of screen, characters in the text box are missing, completely the UI of the app is getting messed up. Is there a way now to modify so that the app supports all the screen resolutions?

Landscape only iPad application using Mono Touch

I'm using Mono Touch to develop a landscape-only iPad application but the simulator doesn't seem to rotate any of the views (or the main window for that matter) to landscape.
I've set the SDK version and Minimum OS version to 4.2.
I have also set the Supported Orientations to Landscape.
Furthermore, I've created a Navigation Controller which overrides the ShouldAutorotateToInterfaceOrientation and sets it to return true. I then added it using window.AddSubview(navigationController.View) but that didn't help either.
I'm using the Rotate Left/Right methods (under Hardware) in the simulator but the whole app rotates with the window and the app stays in Portrait mode. Even the status bar (carrier, time, battery) go off to the right instead of moving up to the top of the screen.
Help?! Anyone?!
Have you set the UIInterfaceOrientation key to landscape as well?
Also, in shouldAutorotateToInterfaceOrientation you'll want to only return true if the new orientation matches the orientation you want.

Set image for windows mobile emulator camera

I am busy developing a windows mobile application that is targeted at WM6 , one of the features i need to use is the camera. In the emulator i can test the camera fine but the image is always black(fades between black and white). I need a way to provide the emulator with a image that i have already taken. At the moment to test i have to deploy the app to my physical device and this is slowing down the process alot.
During testing (on the emulaor) use the image picker instead of the camera.

Categories