Skip to content

Frame control does not respect given size on Android #4249

Open

Description

@queequac

Current behavior

Given a Frame control with a fixed size (Width="300" in the sample below), the size is not respected if the parent element provides less space (a Border with Width="100" in the sample below).

Instead the Frame shrinks to its parents size.

In the sample below, the Frame gets only a width of 100 and textwrapping occours after 100px.
In case of an animation of the parent's width, the frame's content is re-layouted throughout the whole animation and the text wrapping dynamically depending on the parents size.

Note: If the Frame is smaller than the parent, the behavior is correct.
Tested with Android 9 and 10

Expected behavior

Same behavior as under UWP.
While the border restricts the size to 100, the Frame has still a width of 300 and content gets clipped. Frame's content remains static even if parent resizes.

How to reproduce it (as minimally and precisely as possible)

Configure a page like the following.

<Page
    x:Class="BugTest.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid Width="300" Background="Green">
            <Border Width="100" VerticalAlignment="Stretch" HorizontalAlignment="Center" Background="Red">
                <Frame Width="300">
                    <Grid>
                        <TextBlock TextWrapping="WrapWholeWords">
                            Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
                        </TextBlock>
                    </Grid>
                </Frame>
            </Border>
        </Grid>
    </Grid>
</Page>

Environment

Nuget Package Version(s): Tested with 3.0.17 and 3.1.0-dev.741

Affected platform(s):

  • iOS
  • Android
  • WebAssembly
  • WebAssembly renderers for Xamarin.Forms
  • macOS
  • Skia
    • WPF
    • GTK (Linux)
    • Tizen
  • Windows
  • Build tasks
  • Solution Templates

Activity

  1. added
    kind/bug
    triage/untriaged
    on Oct 11, 2020
  2. added
    project/layout 🧱
    and removed
    triage/untriaged
    on Oct 13, 2020
  3. jeromelaban commented on Oct 13, 2020

    @jeromelaban
    Member

    Thank you for the report.

    Currently the layout engine still has corner cases like these ones that are not well supported, particularly when children request a larger size than what the parent offers. We're gradually improving the behavior by getting closer to the original UWP behavior.

    /cc @carldebilly

  4. added
    difficulty/tbd
    on Feb 15, 2021
  5. added
    difficulty/challenging 🤯
    and removed
    difficulty/tbd
    on Jun 4, 2021
  6. self-assigned this
    on Aug 30, 2023
  7. Youssef1313 commented on Aug 30, 2023

    @Youssef1313
    Member

    #13391 might help. Let's see Nope, this issue was for Android.

  8. Youssef1313 commented on Oct 6, 2024

    @Youssef1313
    Member

    #18261 will probably fix this

  9. MartinZikmund commented on Apr 7, 2026

    @MartinZikmund
    Member

    Repro generator

    Runtime test(s) added in branch dev/mazi/repro/4249:

    • src/Uno.UI.RuntimeTests/Tests/Windows_UI_Xaml_Controls/Given_Frame.cs → When_Frame_Has_Fixed_Width_Larger_Than_Parent_Keeps_Width

    ⚠️ The test(s) pass on current master (Skia Desktop) — Frame.ActualWidth is 300 even when inside a Border with Width=100. The original bug was on Android where the Frame shrank to the parent's width. The branch provides a regression guard for the managed path.

  10. added
    native-only
    on Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

difficulty/challenging 🤯has-repro-branchkind/bugnative-onlyproject/layout 🧱

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions