Skip to content

FlyoutPage CollapsedPaneWidth is not working #33785

@devanathan-vaithiyanathan

Description

Description

When CollapseStyle is set to Partial, the flyout always collapses to the default width of 48px, even if a different CollapsedPaneWidth value is assigned.

Steps to Reproduce

1.Run the below code on Windows Platform

using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;
using Microsoft.Maui.Graphics;

namespace MauiApp1;

public class MainPage: FlyoutPage
{
    private Label _label;

    public MainPage()
    {
        // Windows-specific collapse config
        this.On<Microsoft.Maui.Controls.PlatformConfiguration.Windows>()
            .SetCollapseStyle(CollapseStyle.Partial);

        this.On<Microsoft.Maui.Controls.PlatformConfiguration.Windows>()
            .CollapsedPaneWidth(100);

        FlyoutLayoutBehavior = FlyoutLayoutBehavior.Popover;

        // Flyout
        var flyoutPage = new ContentPage
        {
            Title = "Master",
            BackgroundColor = Colors.Blue
        };

        var btn = new Button
        {
            Text = "Change",
            AutomationId = "FlyoutItem",
            HorizontalOptions = LayoutOptions.Start,
            VerticalOptions = LayoutOptions.Center
        };

        btn.Clicked += (s, e) =>
        {
            this.On<Microsoft.Maui.Controls.PlatformConfiguration.Windows>()
                .CollapsedPaneWidth(300);

            _label.Text = "CollapsedPaneWidth set to 300";
        };

        flyoutPage.Content = new VerticalStackLayout
        {
            Padding = 12,
            Children = { btn }
        };

        // Detail
        var detailPage = new ContentPage
        {
            Title = "Detail",
            BackgroundColor = Colors.LightYellow
        };

        _label = new Label
        {
            Text = "Test for CollapsedPaneWidth",
            AutomationId = "CollapsedPaneLabel",
            TextColor = Colors.Black
        };

        detailPage.Content = new VerticalStackLayout
        {
            Padding = 12,
            Spacing = 16,
            Children =
            {
                new Label
                {
                    Text = "Welcome to .NET MAUI!",
                    TextColor = Colors.Black,
                    HorizontalOptions = LayoutOptions.Center
                },
                _label
            }
        };

        Flyout = flyoutPage;
        Detail = detailPage;
    }
}

Link to public reproduction project repository

No response

Version with bug

10.0.30

Is this a regression from previous behavior?

No, this is something new

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Windows 11

Did you find any workaround?

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions