Reputation: 129
I want to know how to disable the swipe in a tabbed page. As I have a sort of horizontal scroll listview on a page the swipe keeps changing the page instead of scrolling the listview.
This is how I got the tabbed page to work.
App.xaml.cs
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
namespace App1
{
public partial class App : Application
{
public App()
{
InitializeComponent();
SetMainPage();
}
public static void SetMainPage()
{
Current.MainPage = new TabbedPage
{
Children =
{
new NavigationPage(new page1())
{
Title = "page1",
Icon = Device.OnPlatform<string>("tab_feed.png",null,null)
},
new NavigationPage(new page2())
{
Title = "page2",
Icon = Device.OnPlatform<string>("tab_feed.png",null,null)
},
new NavigationPage(new page3())
{
Title = "page3",
Icon = Device.OnPlatform<string>("tab_feed.png",null,null)
},
}
};
}
}
}
Upvotes: 1
Views: 765
Reputation: 361
You can use SetIsSwipePagingEnabled.
var page = new TabbedPage
{
Children =
{
new NavigationPage(new MainPage())
{
Title = "page1"
},
new NavigationPage(new MainPage())
{
Title = "page2"
},
new NavigationPage(new MainPage())
{
Title = "page3"
}
}
};
Xamarin.Forms.PlatformConfiguration.AndroidSpecific.TabbedPage.SetIsSwipePagingEnabled(page, false);
Current.MainPage = page;
Upvotes: 1