Listview GroupHeaderTemplate not showing property from Model

2 posts, 0 answers
  1. Chintan
    Chintan avatar
    1 posts
    Member since:
    Jun 2017

    Posted 23 Aug 2017 Link to this post

     

    Hi,

    Below are model properties.

    I am trying to group my list base on the CategoryName and trying to show CategoryName and HealthItemName in my custom header

    Problem: I am able to see the CategoryName  in the header but trying but not able to show up HealthItemName  in my header.

    I am using GroupHeaderTemplate to accomplish the above task. Any pointers?

     

    model class elements {

        String CategoryName
            String CategoryHealthStatusText { get; set; }
            String HealthItemName { get; set; }

    }

     

     

    <telerikDataControls:RadListView AutomationId="RiskList" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" ItemsSource="{Binding Model.RiskItems}" SelectionMode="None">
                    <telerikDataControls:RadListView.ItemStyle>
                        <telerikListView:ListViewItemStyle BackgroundColor="Transparent" BorderLocation="Bottom"/>
                    </telerikDataControls:RadListView.ItemStyle>
                    <telerikDataControls:RadListView.ItemTemplate>
                        <DataTemplate>
                            <telerikListView:ListViewTemplateCell>
                                <telerikListView:ListViewTemplateCell.View>
                                    <StackLayout Padding="0,10" >
                                        <Label AutomationId="LabsResultsDate" Text="{Binding HealthItemName}"></Label>
                                    </StackLayout>
                                </telerikListView:ListViewTemplateCell.View>
                            </telerikListView:ListViewTemplateCell>
                        </DataTemplate>
                    </telerikDataControls:RadListView.ItemTemplate>
                    <telerikDataControls:RadListView.GroupDescriptors>
                        <telerikListView:PropertyGroupDescriptor   PropertyName="CategoryName"/>
                    </telerikDataControls:RadListView.GroupDescriptors>
                   
                    <telerikDataControls:RadListView.GroupHeaderTemplate >
                        <DataTemplate>
                            <StackLayout>
                                <svg:SvgCachedImage AutomationId="CategorySvg" WidthRequest="44" HeightRequest="44" Source= "resource://InteractiveHealth.Mobile.Member.Images.icons.cross_or6.svg"  />
                                <Label Text="{Binding }" HorizontalOptions="Center"/>
                                <Label Text="{Binding HealthItemName}" HorizontalOptions="Center"/>
                            </StackLayout>
                            <!--<Grid BackgroundColor="Red">
                                <Label Text="{Binding }" TextColor="#303030" FontSize="Medium" HorizontalOptions="Center"/>
                            </Grid>-->
                        </DataTemplate>
                    </telerikDataControls:RadListView.GroupHeaderTemplate>
                </telerikDataControls:RadListView>

  2. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    665 posts

    Posted 25 Aug 2017 Link to this post

    Hello Chintan,

    This behavior would be expected as when you are grouping by a specific property, only this property's value is the same for the whole group. The BindingContext of the Group is not an actual item from the source collection as the HealthItemName can be different for the different items from the group. Only the CategoryName is for sure the same for all these items.

    Regards,
    Stefan Nenchev
    Progress Telerik
    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
Back to Top