Forum Xamarin.Forms

GroupHeaderTemplate - IsFirst?

IanVinkIanVink CAInsider, University ✭✭✭

(Simplified example)

In my ListView Header, if it is the first header, then a label should be visible. How do I determine if a Group is the first in a ListView?

                        <ViewCell Height="45">

                                <Label Text="{Binding Key}"  />
                                <Label IsVisible="{Binding ????, Converter={StaticResource IsNotFirst????}}"  />


Best Answer


  • AshokAshAshokAsh USMember ✭✭
    edited September 2018
    Hi, please explain it in detail.
    U can create a property in model like this isfirstheader.
    Then u can manually assign the value to it.
    For ex:
    List<mymodel> groupedlst= new ......
    Now this property avoilable in every view cell.

    In code behind you can select the 1 st group in list andbset this property to false or true what ever you need.
  • IanVinkIanVink CAInsider, University ✭✭✭

    The binding is of the collection, not the group. So if you have a model that has Countries with Cities. The group header Key is Country, but the bindable values in the GroupHeader is not Country, but a list of Cities.

Sign In or Register to comment.