Binding group descriptions.

I am trying setup the grouping of a list view in xaml rather than doing it via code behind - so I can bind to the property name.

I have tried adding the following but get the error that DataSource is not found in SfListView.Xforms.

<sync:SfListView.DataSource.GroupDescriptors>
     <syncds:GroupDescriptor PropertyName="Address.Town"/>
</sync:SfListView.DataSource.GroupDescriptors>

1 Reply

GV Ganesan V Syncfusion Team November 29, 2016 05:46 PM UTC

Hi Richard,

 

Thanks for contacting Syncfusion Support. 

 

You can achieve your requirement like below code snippet,

 

 

  <sync:SfListView x:Name="listView"

                   IsStickyGroupHeader="True"

                   GroupHeaderSize="56"

                   ItemsSource="{Binding Customers}"

                   ItemSize="60">

    <sync:SfListView.GroupHeaderTemplate>

      <DataTemplate>

        <ViewCell>

          <ViewCell.View>

            <StackLayout BackgroundColor="Blue">

              <Label Text="{Binding Key}"/>

            </StackLayout>

          </ViewCell.View>

        </ViewCell>

      </DataTemplate>

    </sync:SfListView.GroupHeaderTemplate>

   

    <sync:SfListView.DataSource>

      <dataSource:DataSource>

        <dataSource:DataSource.GroupDescriptors>

          <dataSource:GroupDescriptor PropertyName="Address.Town"/>

        </dataSource:DataSource.GroupDescriptors>

      </dataSource:DataSource>

    </sync:SfListView.DataSource>

   

    <sync:SfListView.ItemTemplate>

      <DataTemplate>

        <Grid>

          <Label Text="{Binding Name}"/>

        </Grid>

      </DataTemplate>

    </sync:SfListView.ItemTemplate>

  </sync:SfListView>

 

 

We have prepared the sample based on your requirement and you can download the same from the below link,

 

http://www.syncfusion.com/downloads/support/forum/127626/ze/ListViewSample1107493825.zip

 

Please refer the UG documentation link below,

 

https://help.syncfusion.com/xamarin/sflistview/getting-started#grouping

 

Regards,

Ganesan V


Loader.
Up arrow icon