dotnet/maui

TabbedPage with WidthRequest and/or HeightRequest fails to render

Open

#5,747 创建于 2022年4月1日

在 GitHub 查看
 (7 评论) (0 反应) (0 负责人)C# (1,951 fork)batch import
area-controls-tabbedpagegood first issueplatform/macoss/triageds/verifiedt/bug

仓库指标

Star
 (23,245 star)
PR 合并指标
 (平均合并 47天 9小时) (30 天内合并 248 个 PR)

描述

Description

If you add a WidthRequest or HeightRequest to a TabbedPage, it does not render correctly.

Without either, it renders as expected:

If you add a WidthRequest, all tabs get crammed into the corner, even if the WidthRequest is wide enough (on iOS, nothing renders):

In addition, the background of the window changes, suggesting a render failure.

If you add a HeightRequest or both, the page becomes blank.

Steps to Reproduce

  1. Create a new MAUI app
  2. Change your MainPage.xaml.cs to inherit from TabbedPage:
namespace MauiTabbedPageBug;

public partial class MainPage : TabbedPage
{
	public MainPage()
	{
		InitializeComponent();
	}
}
  1. Change your MainPage.xaml to a simple tabbed page:
<?xml version="1.0" encoding="utf-8" ?>
<TabbedPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            x:Class="MauiTabbedPageBug.MainPage"
            BackgroundColor="{DynamicResource SecondaryColor}"
            WidthRequest="640" HeightRequest="480">

    <ContentPage Title="My First Tab" />

    <ContentPage Title="My Second Tab" />

    <ContentPage Title="My Third Tab" />

</TabbedPage>

Remove/add the WidthRequest/HeightRequest attributes.

Version with bug

Preview 14 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

iOS 15.2, macOS 12.3

Did you find any workaround?

No response

Relevant log output

No response

贡献者指南