maui
maui copied to clipboard
Issue with Frame Layout Causing Child AbsoluteLayout Rendering Problems, replace Frame with Grid works
Description
I encountered a rendering issue in a MAUI project where an AbsoluteLayout nested within a Frame did not render correctly. Specifically, when adding borders or other elements to the AbsoluteLayout, the entire layout, including other sibling elements like RadioButton, disappeared or did not render as expected. Replacing the Frame with a Grid resolved the issue, suggesting that the Frame was imposing constraints or had properties affecting the rendering of the AbsoluteLayout.
Steps to Reproduce
- Create a Frame containing a Grid with a RadioButton and an AbsoluteLayout inside the Grid. XAML structure:
<Frame Grid.Row="0" Grid.Column="0" Margin="20,10,10,10" Padding="0,0,0,10">
<Grid RowDefinitions="auto,*">
<RadioButton Content="摆放方式 1" GroupName="PlacementOption" FontSize="Large" HorizontalOptions="Center" Margin="0,0,0,0" Grid.Row="0" />
<AbsoluteLayout x:Name="Layout1" HorizontalOptions="Center" Grid.Row="1">
<Rectangle x:Name="Pallet1" HeightRequest="{Binding DrawingAreaLength}" WidthRequest="{Binding DrawingAreaWidth}" Fill="LightGray" />
</AbsoluteLayout>
</Grid>
</Frame>
- In the OnAppearing method of the page, call a method AddPalletBorder on the AbsoluteLayout (Layout1). Example code in OnAppearing:
protected override void OnAppearing()
{
base.OnAppearing();
_viewModel.InitializeDrawingAreaDimensions();
Layout1.AddPalletBorder(_viewModel.PalletWidth, _viewModel.PalletLength, MillimeterToPixelRatio.PlacementOptionsPage, _viewModel.ProductPalletization.PalletOrientation);
}
Observe that after calling AddPalletBorder, all elements inside the Frame (including the Rectangle and the RadioButton) disappear.
Link to public reproduction project repository
No response
Version with bug
8.0.3
Is this a regression from previous behavior?
No, this is something new
Last version that worked well
Unknown/Other
Affected platforms
I was not able test on other platforms
Affected platform versions
Android 11
Did you find any workaround?
Replace the Frame with a Grid and observe that the layout renders correctly.
Modified XAML structure with Grid:
<Grid Grid.Row="0" Grid.Column="0" Margin="20,10,10,10" Padding="0,0,0,10">
<Grid RowDefinitions="auto,*">
<RadioButton Content="摆放方式 1" GroupName="PlacementOption" FontSize="Large" HorizontalOptions="Center" Margin="0,0,0,0" Grid.Row="0" />
<AbsoluteLayout x:Name="Layout1" HorizontalOptions="Center" Grid.Row="1">
<Rectangle x:Name="Pallet1" HeightRequest="{Binding DrawingAreaLength}" WidthRequest="{Binding DrawingAreaWidth}" Fill="LightGray" />
</AbsoluteLayout>
</Grid>
</Grid>
Relevant log output
No response