Hi,
Welcome to Microsoft Q&A!
I see you have the available width to expand. My meaning is that you need to check whether the Size.Height also meet condition. Maybe your Size.Width is right, how about Size.Height? Only both size.Height and size.Width are correct, this method returns true.
You mentioned you used Screen height as Size.Height, but the available height is less than the Screen height. For example, if display resolution is 1920*1080 and scale is 150%, available work area is 1280 * (720 - taskbarheight). Therefore, the size.height need to be smaller than (720 - taskbarheight), and size.width need to be smaller than 1280.
In a word, you need to set your desiredSize.Height
and desiredSize.Width
to be less than available area according to the display resolution and scale.
If the response is helpful, please click "Accept Answer" and upvote it.
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.