admin管理员组文章数量:1277886
I want to use a CarouselView to show multiple pages in a MAUI app. But it does not work properly only for windows platform. For Android it works fine.
I defined the carousel:
<CarouselView ItemsSource="{Binding Pages}" IsSwipeEnabled="True" Loop="False">
<CarouselView.ItemTemplate>
<DataTemplate>
<ContentView Content="{Binding}"/>
</DataTemplate>
</CarouselView.ItemTemplate>
</CarouselView>
The code behind is:
public MainPage()
{
InitializeComponent();
Pages = new ObservableCollection<ContentView>();
Pages.Add(new Page1());
Pages.Add(new Page2());
Pages.Add(new Page3());
BindingContext = this;
}
public ObservableCollection<ContentView> Pages { get; set; }
The pages are all defined as ContentView because Carousel only accepts ContentViews for content. A sample of page ist:
<ContentView xmlns=";
xmlns:x=";
x:Class="MauiTest.Page1">
<Grid HorizontalOptions="Fill" VerticalOptions="Fill" Background="Blue">
<Label
Text="Page 1"
FontSize="48"
VerticalOptions="Center"
HorizontalOptions="Center" />
</Grid>
</ContentView>
If I start it on windows, the first page is not shown in the carousel. The is a white band on the left side of the window and the second page is shown partially. When I swipe to the other pages, the pages are shown in the right manner. This only occurs on the windows platform. On Android it works fine.
What is the problem on the windows platform ?
Is that a bug ?
本文标签: cMAUI Carousel omit first page for windows platformStack Overflow
版权声明:本文标题:c# - MAUI Carousel omit first page for windows platform - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741277184a2369796.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论