首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Xamarin Expander、Collectionview和Swipeview

Xamarin Expander、Collectionview和Swipeview
EN

Stack Overflow用户
提问于 2020-12-16 01:16:06
回答 1查看 667关注 0票数 1

我正在努力设计一个UI,它有三个不同的分组:

3

  • Friends

  • All
  1. 顶级联系人

订阅和所有的联系人将是大名单。我在这方面的第一次发言如下:

代码语言:javascript
复制
    <Expander>
    <Expander.Header>
        <Label
            FontAttributes="Bold"
            FontSize="Medium"
            Text="Top 3" />
    </Expander.Header>
    <Expander.Content>
        <CollectionView ItemsSource="{Binding MyContacts}">
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <StackLayout>
                        <SwipeView>
                            <SwipeView.LeftItems>
                                <SwipeItem BackgroundColor="Aquamarine" Text="Un Favorite" />
                            </SwipeView.LeftItems>
                            <SwipeView.Content>
                                <Label Text="{Binding DisplayName}" />
                            </SwipeView.Content>
                        </SwipeView>
                    </StackLayout>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>
    </Expander.Content>
</Expander>
<Expander>
    <Expander.Header>
        <Label
            FontAttributes="Bold"
            FontSize="Medium"
            Text="Friends" />
    </Expander.Header>
    <Expander.Content>
        <CollectionView ItemsSource="{Binding UppContacts}">
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <StackLayout>
                        <SwipeView>
                            <SwipeView.LeftItems>

                                <SwipeItem BackgroundColor="Brown" Text="Fav" />

                            </SwipeView.LeftItems>
                            <SwipeView.Content>
                                <Label Text="{Binding DisplayName}" />
                            </SwipeView.Content>
                        </SwipeView>
                    </StackLayout>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>
    </Expander.Content>
</Expander>

但我似乎不能在一页中放一个以上的扩展器。当我一次只做一次的时候

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-18 14:34:10

当您说页面上不能有多个扩展程序时,是否意味着您收到了一条错误消息,表示“属性”内容“已多次设置”之类的内容?

如果是这样的话,那么您可以简单地解决这个问题,方法是将所有的展开器包装在一个容器中。

例如:

代码语言:javascript
复制
<StackLayout>
        <Expander>
            <Expander.Header>
                <Label
                    FontAttributes="Bold"
                    FontSize="Medium"
                    Text="Top 3" />
            </Expander.Header>
            <Expander.Content>
                <CollectionView ItemsSource="{Binding MyContacts}">
                    <CollectionView.ItemTemplate>
                        <DataTemplate>
                            <StackLayout>
                                <SwipeView>
                                    <SwipeView.LeftItems>
                                        <SwipeItem BackgroundColor="Aquamarine" Text="Unfavorite" />
                                    </SwipeView.LeftItems>
                                    <SwipeView.Content>
                                        <Label Text="{Binding DisplayName}" />
                                    </SwipeView.Content>
                                </SwipeView>
                            </StackLayout>
                        </DataTemplate>
                    </CollectionView.ItemTemplate>
                </CollectionView>
            </Expander.Content>
        </Expander>
        <Expander>
            <Expander.Header>
                <Label
                    FontAttributes="Bold"
                    FontSize="Medium"
                    Text="Friends" />
            </Expander.Header>
            <Expander.Content>
                <CollectionView ItemsSource="{Binding UppContacts}">
                    <CollectionView.ItemTemplate>
                        <DataTemplate>
                            <StackLayout>
                                <SwipeView>
                                    <SwipeView.LeftItems>

                                        <SwipeItem BackgroundColor="Brown" Text="Fav" />

                                    </SwipeView.LeftItems>
                                    <SwipeView.Content>
                                        <Label Text="{Binding DisplayName}" />
                                    </SwipeView.Content>
                                </SwipeView>
                            </StackLayout>
                        </DataTemplate>
                    </CollectionView.ItemTemplate>
                </CollectionView>
            </Expander.Content>
        </Expander>
    </StackLayout>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65315965

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档