【发布时间】:2021-12-26 13:42:06
【问题描述】:
【问题讨论】:
-
谷歌
xamarin forms listview pagination。 (我个人不会使用 CarouselView 来执行此操作。) -
根据你的说法,你有很多数据,不管你用数据库,都可以根据页数控制显示的数据。
标签: c# xamarin xamarin.forms
【问题讨论】:
xamarin forms listview pagination。 (我个人不会使用 CarouselView 来执行此操作。)
标签: c# xamarin xamarin.forms
<ScrollView>
<SomeDataContentView Data={Binding SelectedData} />
</ScrollView>
<StackLayout BindableLayout.ItemSource={Binding ListOfPageNumber}
x:Name="SomeStack"
Orientation="Horizontal">
<BindableLayout.ItemTemplate>
<DataTemplate>
<Button Text={Binding .}
Command={Binding Path=BindingContext.SelectPage_Command, Source={x:Reference SomeStack}
CommandParameter={Binding .}
</DataTemplate>
</BindableLayout.ItemTemplate>
视图模型:
public SelectPage_Command = new Command((param) =>
{
var pageNo = (int)param;
SelectedData = DataDividedByPage[pageNo];
});
SomeDataContentView.cs:
SomeDataContentView : ContentView
public static readonly BindableProperty DataProperty = BindableProperty.Create(
nameof(Data), typeof(string), typeof(SomeDataContentView ), defaultValue: "", propertyChanged: DoSomethingWhenDataChanged);
public string Data
{
get => (string)GetValue(DataProperty perty);
set => SetValue(DataProperty , value);
}
并创建您的 SomeDataContentView.xaml 以显示您想要的数据。
这可能是我的做法。
我是凭记忆完成的,跳过了一两件事。但如果你需要我,我稍后会回来。
【讨论】: