how do I find the working area of my uwp app in .net using C#

Joe Babb 60 Reputation points
2024-04-24T13:23:16.3+00:00

This is a simple question but I'm having a rough time finding an answer. What I want to find is the working area of my application. I'm working in Visual Studio 2022 and have created the basic project. Searches on the internet result in many answers that don't work for uwp or .net. Answers usually show up for Windows Forms.

I wish there was a straight forward site where I could simply look up .NET classes and namespaces for UWP. If there is, please direct me to it.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,398 questions
Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 15,056 Reputation points Microsoft Vendor
    2024-04-26T06:35:13.9033333+00:00

    Hi @Joe Babb ,

    It is recommende to use Window.Bounds Property, it gets a Rect value that contains the origin, height, and width of the client area of the window, in device-independent pixels (DIPs).

     Rect rect = Window.Current.Bounds;
    

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful