KEMBAR78
Actionsheet maximum size has been hardcoded on windows, creating display issues · Issue #25200 · dotnet/maui · GitHub
Skip to content

Actionsheet maximum size has been hardcoded on windows, creating display issues #25200

@MitchBomcanhao

Description

@MitchBomcanhao

Description

Context:

Microsoft picked it up, and "fixed" it by hardcoding a maximum size to the control. See PR #7025
Image
this is an unacceptable change. the "test" in the PR just proves that if you have just the right amount of content to fit in the newly hardcoded maximum size, the control "works".
well, but if you deviate ever so slightly and make something with more content, then it all falls apart, as content gets truncated and you are presented with ridiculous scrollbars.

this actionsheet has 6 actions an one cancel button. you can't see all the actions nor the cancel button. and the title isn't visible either.
Image

this was highlighted back in August 2023 on another issue: #14829 - DisplayActionSheet still not working on Windows.
In March 2024 I commented on said issue and pointed to the rootcause being the bad fix from 2022. Offered a workaround too.

A few days after my comments, and following many months of inactivity since the issue had been opened, someone else at Microsoft posted a PR to fix the issue.
one would think they read the ticket and understood the various complaints that had been made.
the issue was later closed as "completed", and months later marked as fixed in some release versions.

I just looked at the PR and noticed they haven't done anything about the hardcoded maximum size of the control, which is still breaking people's UI.
This is very disappointing.
Not only are issues being caused by really bad "fixes", they're also being ignored.

Steps to Reproduce

  1. Create a new maui template solution.
  2. Replace the existing OnCounterClicked method with the one shown below.
  3. Run the app and click the button.
  4. OBSERVED:
  5. control truncates content Image
  6. EXPECTED (achieved via workaround shown below):
  7. control displays all actions and buttons. Image
        private async void OnCounterClicked(object sender, EventArgs e)
        {
            await DisplayActionSheet("Actionsheet is set to hardcoded maxheight and maxwidth", "Cancel", null, "Option 1/6", "Option 2/6", "Option 3/6", "Option 4/6", "Option 5/6", "Option 6/6");
        }

Link to public reproduction project repository

No response

Version with bug

8.0.91 SR9.1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

Add the following to the windows platform app.xaml file. This will overwrite the hardcoded sizes added my Microsoft.
it is possible that this isn't exactly ideal, but I have not spent too much time figuring out which bits I needed to keep or could discard.

xmlns:contract7NotPresent="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract,7)"
xmlns:contract7Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,7)"
<Style x:Key="MauiFlyoutPresenterStyle" TargetType="FlyoutPresenter">
    <Setter Property="MaxHeight" Value="{x:Null}" />
    <Setter Property="MaxWidth" Value="{x:Null}" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="FlyoutPresenter">
                <Border MinWidth="350"
                        Padding="{ThemeResource FlyoutBorderThemePadding}"
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        contract7NotPresent:CornerRadius="{ThemeResource OverlayCornerRadius}"
                        contract7Present:BackgroundSizing="OuterBorderEdge"
                        contract7Present:CornerRadius="{TemplateBinding CornerRadius}"
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}">
                    <ScrollViewer x:Name="ScrollViewer"
                                  AutomationProperties.AccessibilityView="Raw"
                                  HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                  HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
                                  VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                                  VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
                                  ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}">
                        <ContentPresenter Margin="{TemplateBinding Padding}"
                                          HorizontalAlignment="Stretch"
                                          VerticalAlignment="Top"
                                          Content="{TemplateBinding Content}"
                                          ContentTemplate="{TemplateBinding ContentTemplate}"
                                          ContentTransitions="{TemplateBinding ContentTransitions}" />
                    </ScrollViewer>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions