Xamarin.forms: UWP Master Detail Page Height Incorrect After Resizing App Window

Created on 24 Sep 2018  路  8Comments  路  Source: xamarin/Xamarin.Forms

Description

If you resize the app window height, the master detail page will incorrectly display the first time.

Steps to Reproduce

0453a16e-fdbd-4fd7-8fd6-cb8d4a653f7e

  1. Start a UWP master detail page template app
  2. Open hamburger menu
  3. Resize window height
  4. Open hamburger menu
  5. Notice the incorrect height
  6. Close hamburger menu
  7. Open hamburger menu
  8. Height is now correct

Expected Behavior

After resizing the window I would expect the master detail page to have the correct height.

Actual Behavior

After resizing the window the master detail page's height is incorrect until closing and re-opening.

Basic Information

  • Version with issue: <= 3.2.0.839982
  • Last known good version: Never/Unknown, I tested all the way back to XF 2.5.1 and all versions had the same issue.
  • IDE: VS 15.8.4
  • Platform Target Frameworks:

    • UWP: 16299

Reproduction Link

https://drive.google.com/open?id=1sjSZEB7eC3rLAOyG9plHbRNK469Fjnbd

4 UWP bug

Most helpful comment

We are also getting this on our UWP app.

All 8 comments

We are also getting this on our UWP app.

I guess I have the same issue.

My menu is opened always and the menu's height is incorrect until resizing the window.

I'm also noticing behavior like this

What is the status? Does it is solved ?

@samhouts I'm willing to take a look at this and submit a PR if I can figure it out if you would like to mark it as in progress.

I have a lead on the cause, but need to dig into it a little more first.

If you look at the Xamarin.Forms.Platform.UWP.MasterDetailControl line 160, the MasterSize Property.

The first thing it does is try to use the master content presenters actual height. Which appears to be the size from the last time the Master panel was displayed. Regardless of the current size of the current master panel. A simple solution appears to be to just ignore this and always start with the actual height of the MasterDetailControl. I haven't been able to figure out why the line of code below was originally added and removing it doesn't seem to impact anything in the control gallery when I test. But I'm not 100% sure if there would be a performance impact.

I'll prepare a pull request and hope that XF Team members that may be more familiar with the history of this control will review.

// Use the ActualHeight of the _masterPresenter to automatically adjust for the Master Title
double height = _masterPresenter?.ActualHeight ?? 0;

// If there's no content, use the height of the control to make sure the background color expands.
if (height == 0)
height = ActualHeight;

@bmacombe Sounds like a plan! Thanks!

Submitted PR #5338 to resolve

Was this page helpful?
0 / 5 - 0 ratings