How to set ScrollView content size?

Now that the ScrollView ContentSize property is read-only, how to set the size of the ScrollView content to SET? The same property that is configured in UIScrollView (but not in xamine form)

I have it:

<ScrollView Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" HorizontalOptions="FillAndExpand" x:Name="attachmentScroller" > <StackLayout x:Name="AttachmentsView" Orientation="Horizontal" VerticalOptions="Fill"/> </ScrollView> 

what I tried sets AttachmentsView.MinimumWidthRequest to the desired contentWidth; But this does not increase the width of the contents of the parent scroll to the desired value.

+4
source share
2 answers

You can set the content size set by setting the content property instead of ScrollView.

Here he is in xaml

 <ScrollView> <StackLayout HeightRequest="100" /> </ScrollView> 
+2
source

To stop scrolling, limiting the size of the contained content to its own size, make sure you set

ScrollView Orientation = "Horizontal" or "Both" or "Vertical" respectively.

i.e. for your example -

  <ScrollView Orientation="Horizontal" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" HorizontalOptions="FillAndExpand" x:Name="attachmentScroller"> <StackLayout WidthRequest="1000" x:Name="AttachmentsView" Orientation="Horizontal" VerticalOptions="Fill"/> </ScrollView> 
0
source

All Articles