Ruchita Patel
Ruchita Patel

Reputation: 1

Xamarin Form - ScrollView and its Content

I have created one sample application and in that I have taken one ContentPage and did its design as below

 <ContentPage>
   <ScrollView Orientation="Horizontal" x:Name="scroll">
    <StackLayout HeightRequest="50" Orientation="Horizontal">
        <Label x:Name="lbl1" Text="label1!" VerticalOptions="Center" HorizontalOptions="Center" />
        <Label x:Name="lbl2" Text="label2" VerticalOptions="Center" HorizontalOptions="Center" />
        <Label x:Name="lbl3" Text="label3" VerticalOptions="Center" HorizontalOptions="Center" />
        <Label x:Name="lbl4" Text="label4" VerticalOptions="Center" HorizontalOptions="Center" />   
    </StackLayout>
  </ScrollView>
</ContentPage>

It works absolute fine , but when I take ContentView instead of ContentPage , I got blank page on emulator.

Is it bug ? or I did something wrong in this.

Upvotes: 0

Views: 466

Answers (1)

Jake Shanley
Jake Shanley

Reputation: 913

Xamarin.Forms works by bringing Pages in and out of the view. A ContentPage is a Page, but a ContentView is NOT a Page.

If it helps, a ContentView is analagous to a UserControl in WPF.

See this forum for some other explanations on the subject.

Upvotes: 1

Related Questions