How to turn off a Group header in SfListView?

Masha0307 41 Reputation points
2021-06-09T15:25:50.95+00:00

I have a problem.I want to turn off a Group header in SfListView.I read on the forums to turn off IsStickyGroupHeader,I did it but IsStickyGroupHeader="False" does not work.Maybe I understand something wrong.Please help me.Thank you

<syncfusion:SfListView
x:Name="listView"
Grid.Row="0"
ItemSize="40"
IsStickyGroupHeader="False"
ItemsSource="{Binding contactsinfo}"
SelectionMode="None">

            <syncfusion:SfListView.ItemTemplate>  
                <DataTemplate>  
                    <ViewCell>  
                        <ViewCell.View>  
                            <StackLayout>  
                                <Grid>  
                                    <Grid.RowDefinitions>  
                                        <RowDefinition Height="Auto" />  
                                    </Grid.RowDefinitions>  
                                    <Grid.ColumnDefinitions>  
                                        <ColumnDefinition Width="100" />  
                                        <ColumnDefinition Width="*" />  

                                    </Grid.ColumnDefinitions>  

                                    <StackLayout  
                                        Grid.Column="1"  
                                        HorizontalOptions="StartAndExpand"  
                                        Orientation="Vertical"  
                                        VerticalOptions="Center">  
                                        <Label  
                                            HorizontalOptions="Center"  
                                            HorizontalTextAlignment="Center"  
                                            LineBreakMode="WordWrap"  
                                            Text="{Binding ContactName}"  
                                            TextColor="#474747"  
                                            VerticalOptions="Center"  
                                            VerticalTextAlignment="Center" />  

                                    </StackLayout>  
                                </Grid>  

                                <StackLayout BackgroundColor="LightGray" HeightRequest="1" />  

                            </StackLayout>  
                        </ViewCell.View>  
                    </ViewCell>  
                </DataTemplate>  
            </syncfusion:SfListView.ItemTemplate>  
        </syncfusion:SfListView>  

103942-image.png

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,334 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,827 questions
{count} votes

Accepted answer
  1. JessieZhang-MSFT 7,706 Reputation points Microsoft Vendor
    2021-06-10T09:52:31.597+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    The SfListView supports sorting the data either in ascending or descending order by using DataSource.SortDescriptors property and by using the custom logic.

    Sorting the data by creating the SortDescriptor with required property name and direction and adding it into the DataSource.SortDescriptors property.

    SortDescriptor object holds the following three properties:

    • PropertyName: Describes the name of the sorted property.
    • Direction: Describes an object of type ListSortDirection that defines the sorting direction.
    • Comparer: Describes the comparer to be applied when sorting take place.

    You can refe to the following code :

    <ContentPage xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms"  
                 xmlns:data="clr-namespace:Syncfusion.DataSource;assembly=Syncfusion.DataSource.Portable">  
      <sync:SfListView x:Name="listView">  
                <sync:SfListView.DataSource>  
                    <data:DataSource>  
                        <data:DataSource.SortDescriptors>  
                            <data:SortDescriptor PropertyName="ContactName" Direction="Ascending"/>  
                        </data:DataSource.SortDescriptors>  
                    </data:DataSource>  
                </sync:SfListView.DataSource>  
      </syncfusion:SfListView>  
    </ContentPage>  
    

    The result is:

    104227-image.png

    For more details, you can check: Programmatic sorting .

    And you can use custom sorting to achieve this.

    Best Regards,

    Jessie Zhang

    ---
    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.