xamarin/Xamarin.Forms

Xamarin.Forms Grid.SetRowSpan(xxx,2) issue

Aperta

#9097 aperta il 6 gen 2020

 (2 commenti) (0 reazioni) (0 assegnatari)C# (1926 fork)batch import
a/layoutfeedback-tickethelp wantedinactives/unverifiedt/bug :bug:up-for-grabs

Metriche repository

Star
 (5644 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

This issue has been moved from a ticket on Developer Community.


This is the section of xaml I am using on a form, where I define the layout in code behind.

The codebehind sets the Grid. When I use the following it displays on the device I am testing on as screenshot 1.

void SetupLandscapeLayout() { grid. RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); grid. RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });

grid. ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid. ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid. ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid. ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid. ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid. ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid. ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid. ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); grid. ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });

grid. Children.Add(view: labelType, 0, 0); //Grid.SetRowSpan(labelType, 2); grid. Children.Add(view: interactionType, 1, 0); Grid.SetRowSpan(interactionType, 2); Grid.SetColumnSpan(interactionType, 3);

When I un-comment the labelType RowSpan I get screenshot 2.

I have reduced the code to the minimum trying to find what is wrong (overlapping fields etc) but cannot find any reason it is failing.

I have similar code running correctly elsewhere in the same app which works fine, although I have had instances where the expected layout dowsn't happen for some reason, but nothing as blatant as this


Original Comments

Visual Studio Feedback System on 12/16/2019, 02:17 AM:


Original Solutions

(no solutions)

Guida contributor