我正在使用 Xamarin 表单创建 TabbedPage。问题是我想在选项卡之间滑动,而默认情况下这是禁用的。我发现一个名为 ExtendedTabbedPage 的类,它有一个名为 SwipeEnable 的属性和一些调用滑动事件的方法。 这是我的类,它从 ExtendedTabbedPage 扩展并创建两个包含一些内容的选项卡。我设置了 swipeEnabled 属性的值,但它没有执行任何操作。是否有办法从此类调用滑动事件?
public class TabbedPageComplete: ExtendedTabbedPage
{
public TabbedPageComplete ()
{
this.Title = "TabbedPage";
this.SwipeEnabled = true;
this.Children.Add (new ContentPage
{
Title = "Blue",
Content = new BoxView
{
Color = Color.Blue,
HeightRequest = 100f,
VerticalOptions = LayoutOptions.Center
},
}
);
this.Children.Add (new ContentPage {
Title = "Blue and Red",
Content = new StackLayout {
Children = {
new BoxView { Color = Color.Blue },
new BoxView { Color = Color.Red}
}
}
});
}
}
最佳答案
您是否也使用 iOS 进行了测试,还是仅使用 Android 进行了测试? ExtendedTabbedPage 目前仅针对 iOS 实现 ExtendedTabbedPageRenderer.cs而for Android is still under development .
关于Xamarin 表单选项卡式分页滑动调用事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26176526/