Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do I SET the size of the ScrollView content?

Now that ScrollView ContentSize property is readonly how do I SET the size of the ScrollView content? That very same property that is settable in UIScrollView (but not in xamarin forms)

I have this:

  <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've tried is setting AttachmentsView.MinimumWidthRequest to the desired contentWidth; But that does not seem to expand the parent's scrollview content width to the desired value.

like image 317
Anton Tropashko Avatar asked Oct 19 '22 05:10

Anton Tropashko


1 Answers

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

Here's it in xaml

<ScrollView>
    <StackLayout HeightRequest="100" />
</ScrollView>
like image 193
Stephane Delcroix Avatar answered Oct 22 '22 20:10

Stephane Delcroix