i need your help. I actually begin with Xamarin.forms. I have a HomePage : TabbedPage, which have 3 ContentPage.
One of those 3 pages is a ListView, which on item tapped, call an another Content Page with a ScrollView.
ListView.ItemTapped += async (o, e) =>
{
var myList = (ListView)o;
var newPage = (myList.SelectedItem as Object);
await Navigation.PushAsync(new Page(Object));
myList.SelectedItem = null; // de-select the row
};
I have a ScrollView on this new Page, but it doesnt work.
I copied the page and called it without Navigation.PushAsync, and the scroll WORKS.
I actually only use iOS Emulator.
Do you have any idea of the reason ?
I'm using xaml.
Thanks a lot. If you need more informations, tell me..!
There is my App.xaml.cs
public App()
{
InitializeComponent();
MainPage = new HomePage();
}
There is my HomePage :
public class HomePage : TabbedPage
{
public HomePage()
{
var profilPage = new NavigationPage(new UserPage());
profilPage.Title = "Profil";
profilPage.Icon = "user.png";
var gameListPage = new NavigationPage(new GameListPage());
gameListPage.Title = "Jeux";
gameListPage.Icon = "gamepad.png";
Children.Add(profilPage);
Children.Add(gameListPage);
}
}
And my homePage call GameListPage :
<ContentPage.Content>
<ListView x:Name="GameListView">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding name}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ContentPage.Content>
With event :
GameListView.ItemTapped += async (o, e) =>
{
var myList = (ListView)o;
var game = (myList.SelectedItem as Game);
await Navigation.PushAsync(new GamePage(game));
//await DisplayAlert("Tapped", game.name, "OK");
myList.SelectedItem = null; // de-select the row
};
And the GamePage is here :
gamePage.xaml
<ContentPage.Content>
<ScrollView>
<RelativeLayout x:Name="RelativeLayout" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<Grid RelativeLayout.WidthConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Width,
Factor=1,
Constant=0}"
RelativeLayout.HeightConstraint =
"{ConstraintExpression Type=RelativeToParent,
Property=Height,
Factor=1,
Constant=0}">
<Grid.RowDefinitions>
<RowDefinition Height="500">
</RowDefinition>
<RowDefinition Height="500">
</RowDefinition>
<RowDefinition Height="550">
</RowDefinition>
<RowDefinition Height="20">
</RowDefinition>
<RowDefinition Height="300">
</RowDefinition>
<RowDefinition Height="500">
</RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*">
</ColumnDefinition>
<ColumnDefinition Width="*">
</ColumnDefinition>
<ColumnDefinition Width="*">
</ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.Children>
<StackLayout Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3">
<BoxView BackgroundColor="Black" HeightRequest="500"></BoxView>
</StackLayout>
<StackLayout Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3">
<BoxView BackgroundColor="Black" HeightRequest="500"></BoxView>
</StackLayout>
<StackLayout Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
<BoxView BackgroundColor="Black" HeightRequest="500"></BoxView>
</StackLayout>
</Grid.Children>
</Grid>
</RelativeLayout>
</ScrollView>
</ContentPage.Content>
I putted this content actually to test the scroll. And, in one another contentPage, with the same content, i can scroll. Its just on this page, which is call with async Navigation.PushAsync...
Edited : SOLVED with a StackLayout with HeightRequest to 1500. My scroll work now.. temporary solved so.. Its not proper