How to implement screen rotation animation in application C#

epice500 1 Reputation point
2021-01-28T15:59:02.187+00:00

Hello,

I have been working on an application that requires the screen to be able to rotate, in that the application is able to select a new screen orientation for any display connected to the pc. This is true for any amount of displays that are attached to the computer. I have successfully designed a UI interface in wpf for the application, as well as implemented most of the functionality that I need including a C# class that controls the orientation of the screen very effectively. There is however one final touch that the application needs, and that is the introduction of an animation that plays while the screen is reformatting. I have seen on 2 in 1 laptop and windows tablets that this functionality is already built into windows, I have seen it in action on a family members 2 in 1 Lenovo laptop. In the animation the screen zooms out while the screen reformats, and then zooms back into the new orientation, which provides a much cleaner user experience then what my application currently does, which is basically let the user see the screen reformat. I found this Microsoft documentation on the subject (however this was for in directx programming I believe): https://learn.microsoft.com/en-us/windows/uwp/gaming/supporting-screen-rotation-directx-and-cpp. I attempted this implementation of the screen rotation animation (contained in the section: Reduce the rotation delay by using CoreWindowResizeManager), however it does not work and throws the exception "element not found" (is this because I am missing a directx import or something?). I am curious is anyone knows how to implement this feature in a windows 10 application, watching the screen reformat just doesn't offer an acceptable user experience. Also I am happy to post my code for anyone that needs it. Thank you!

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,705 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,681 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,309 questions
{count} votes