maui: ScrollView with BindableLayout.ItemsSource is not recalculate new size on iOS

Description

I have this code, and after I changed Slots collection, ScrollView is not recalulate it’s size.

<ScrollView x:Name="scrollView" VerticalScrollBarVisibility="Default">
<Grid>
<StackLayout Margin="16,0">
<StackLayout x:Name="DaysCollection" BindableLayout.ItemsSource="{Binding Days}" Spacing="18">
	<BindableLayout.ItemTemplate>
		<DataTemplate x:DataType="general:AvailabilityDayModel">
			<StackLayout Spacing="20">
				<StackLayout x:Name="AvailabilitySlot" BindableLayout.ItemsSource="{Binding Slots}" Spacing="4">
					<BindableLayout.ItemTemplate>
						<DataTemplate x:DataType="general:AvailabilitySlotModel">
							<HorizontalStackLayout>
								<Label Text="-" Style="{StaticResource ParagraphRegular}" Margin="8" VerticalOptions="Center" />
								<Button ImageSource="trash.png" Clicked="RemoveAvailability_Clicked" Margin="-8"
														  CommandParameter="{Binding .}" BackgroundColor="Transparent" VerticalOptions="Center"
														  Style="{StaticResource SecondaryDefaultSmall}"   />

								<Button ImageSource="plus_big.png"  Clicked="AddAvailability_Clicked" Margin="-8"
									CommandParameter="{Binding ParentDay}"  BackgroundColor="Transparent" VerticalOptions="Center"
									Style="{StaticResource SecondaryDefaultSmall}"  />
							</HorizontalStackLayout>
						</DataTemplate>
					</BindableLayout.ItemTemplate>
				</StackLayout>

			</StackLayout>
		</DataTemplate>
	</BindableLayout.ItemTemplate>
</StackLayout>

<Button IsVisible="{OnIdiom false, Phone=true}" Text="Save" Command="{Binding SaveChangesCommand}" Margin="16,32,16,0" Style="{StaticResource MainDefaultBig}" />
</StackLayout>
</Grid>
</ScrollView>

Steps to Reproduce

  1. Create ScrollView
  2. Inside ScrollView add Grid, then StackView
  3. Add one more StackView with BindableLayout.ItemsSource
  4. add one more butto wich will add new item into BindableLayout.ItemsSource and will rise event to add one more item
  5. on iOS after adding items ScrollView will not recalulate size and you will not see scroll
  6. on Android all is ok

Link to public reproduction project repository

no

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16

Did you find any workaround?

If I will call InvalidateMeasure(); after adding items in Page all is fine, so it looks like ScrollView not notified about chagin size of childrens

Relevant log output

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 4
  • Comments: 18 (6 by maintainers)

Most upvoted comments

Issue also occurs on Windows. I think this needs some urgent attention. Looks like there are related issues too (#13246 and #11987).

BindableLayoutIssue.zip

I can’t reproduce my problem specifically, maybe because I now have a dotnet 7.200 preview But in my example there is a new problem, that after adding an internal element, the application no longer responds to buttons.

Have the exact same issue!

BindableLayoutIssue.zip

I can’t reproduce my problem specifically, maybe because I now have a dotnet 7.200 preview But in my example there is a new problem, that after adding an internal element, the application no longer responds to buttons.

It’s possible this is fixed by #16385.

Confirmed, fixed by #16385.

It’s possible this is fixed by #16385.

Verified this issue with Visual Studio Enterprise 17.7.0 Preview 2.0. Can repro on iOS platform with sample project. BindableLayoutIssue.zip 12727

exactly the same issue

BindableLayoutIssue.zip

Конкретно свою проблему воспроизвести не могу, может потому что у меня сейчас dotnet 7.200 preview Но в моем примере появилась новая проблема, что после добавления внутреннего элемента приложение перестало реагировать на кнопки.

Similarly, clicks on elements stopped working on ios.