Binding group headers

4 posts, 0 answers
  1. Ömer
    Ömer avatar
    1 posts
    Member since:
    Oct 2013

    Posted 17 Jul 2015 Link to this post

    I have the following RadListView:


    <telerik:RadListView x:Name="PhaseListView" ItemsSource="{Binding Items}">
                     <Label Text="{Binding}" TextColor="White" HorizontalOptions="Center"></Label>
                 <template:ListViewTemplateCell >
                       <StackLayout Orientation="Horizontal">
                         <Label Text="{Binding ID}"></Label>
                       <Slider Value="{Binding Complete}" IsEnabled="False" HorizontalOptions="FillAndExpand"></Slider>
               <template:ListViewLinearLayout Orientation="Vertical"/>

    The grouping is done in the code behind via:

    public partial class PhaseXaml : ContentPage
            public RadListView PhaseList { get; private set; }
            public PhaseXaml()
                PhaseList = PhaseListView; // So it can be accessed from viewmodel
                var lookup = new DelegateGroupDescriptor{KeyExtractor = new PhaseGrouping().GetKey};
                BindingContext = new PhaseViewModel(new PhaseRepository(), this);
            private class PhaseGrouping : IKeyLookup
                public object GetKey(object item)
                    var phase = (Phase) item;
                    return phase.ProjectName;

    The ProjectName property is a string, now it does group the items correctly but the header text remains empty. When I break in the GetKey method I can see that at that point the ProjectName property does have a value. I have tried other string Properties on the phase object and it appears that while it groups correctly the header stays empty. If I bind it to say an int (Project id) that will be displayed in the header.
    I have attempted to group with a PropertyGroupDescriptor as well but that has the same results. I'm testing on an Android device at the moment.

     So my question is is there a way to get string properties to display in the groupheader, and if not whether it's possible to bind the text of the header to another property than is used to group the item (that we can assume is same for all items in the group)

  2. Rosy Topchiyska
    Rosy Topchiyska avatar
    586 posts

    Posted 22 Jul 2015 Link to this post

    Hello Ömer,

    Thank you for contacting us.

    We must admit that there is an issue with the binding context of the group headers - it becomes null due to a problem with the conversion from Java.Lang.Object. We can not suggest a workaround at this moment. We will fix this issue for the next release. The official release is planned for the end of September, but it is very probable to have an internal build earlier.

    I have updated your Telerik points as a token of gratitude for bringing this issue to our attention.

    Please, let us know if you have any other questions.

    Rosy Topchiyska
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Elad
    Elad avatar
    14 posts
    Member since:
    Jun 2012

    Posted 07 Apr 2016 in reply to Rosy Topchiyska Link to this post


    is this issue solved? 

    if not, is there any work around to set the template group header custom cell?


  4. Elad
    Elad avatar
    14 posts
    Member since:
    Jun 2012

    Posted 07 Apr 2016 in reply to Elad Link to this post

    I can confirm this is solved in the latest release,

    template should build as any layout view and not as ListViewGroupHeaderCell


Back to Top