CollectionView Shows Extra Items in Groups with Multiple Entries

0 Answers 65 Views
CollectionView
Joe
Top achievements
Rank 2
Iron
Veteran
Iron
Joe asked on 12 Nov 2024, 09:05 PM

I setup a CollectionView with grouping based on an attribute of the item.  Everything seems to be working, except in the groups with more than one item there are a couple extra items in the list.  One is the name of the group, and the other is 'Grand Total'

If I click on them the Item tapped handler receives a string.  I do not see anything to turn this behavior on/off.  My setup for the RadCollectionView is pretty basic


    <telerik:RadCollectionView x:Name="RadCollectionView"
                         BackgroundColor="Transparent" VerticalOptions="Fill"
                         ItemsSource="{Binding SymbolItems}"
                         ItemViewStyle="{StaticResource SymbolItemStyle}"
                         SelectionMode="Single"
                         SelectedItem="{Binding SelectedSymbolItem}"
                         ItemTapCommand="{Binding SymbolClickedCommand}">
      
      <telerik:RadCollectionView.GroupDescriptors>
        <telerik:PropertyGroupDescriptor PropertyName="Parent" />
      </telerik:RadCollectionView.GroupDescriptors>


      <telerik:RadCollectionView.ItemTemplate>
        <DataTemplate x:DataType="edit:SymbolItem">
          <Grid ColumnDefinitions="40, *" Margin="40,0,0,0">
            <ffImage:CachedImage Grid.Column="0" Grid.Row="0" HeightRequest="60"
                                 Source="{Binding ImageSource}"/>
            <Label Grid.Row="0" Grid.Column="1"
                   VerticalOptions="Center"
                   FontAttributes="Bold"
                   FontSize="17"
                   VerticalTextAlignment="Center"
                   Margin="10,0,0,0"
                   Text="{Binding Name}"/>
          </Grid>
        </DataTemplate>
      </telerik:RadCollectionView.ItemTemplate>
    </telerik:RadCollectionView>



      <Style x:Key="SymbolItemStyle" TargetType="telerik:RadCollectionViewItemView">
        <Setter Property="VisualStateManager.VisualStateGroups">
          <VisualStateGroupList>
            <VisualStateGroup Name="CommonStates">
              <VisualState Name="Normal">
                <VisualState.Setters>
                  <Setter Property="BackgroundColor" Value="Transparent" />
                </VisualState.Setters>
              </VisualState>
              <VisualState Name="Selected">
                <VisualState.Setters>
                  <Setter Property="BackgroundColor" Value="LightGrey" />
                  <Setter Property="BorderColor" Value="#0A3A82"></Setter>
                  <Setter Property="BorderThickness" Value="2"></Setter>
                </VisualState.Setters>
              </VisualState>
            </VisualStateGroup>
          </VisualStateGroupList>
        </Setter>
      </Style>

What is required to remove these items from the view?

Thanks -Joe

Didi
Telerik team
commented on 13 Nov 2024, 10:09 AM

Hi Joe,

I tested the case in a sample and cannot reproduce the behavior. Maybe I am missing something from the setup. I have attached my sample app.

Next Steps:

Modify the app to match the exact case in which the behavior occurs, then send the app back to me.

If you do not want to send the project with the setup in the forum, open a support ticket and attach the project there.

Joe
Top achievements
Rank 2
Iron
Veteran
Iron
commented on 19 Nov 2024, 04:37 PM

I was using a library ObservableRangeCollection which adds Range methods and for some reasons when using the it added the extra rows.  Although for the life of me I can not see what it does different that would cause this.  But switched back to the core ObservableCollection and add in a loop and everything works as expected.  Thanks for taking the time to assist

No answers yet. Maybe you can help?

Tags
CollectionView
Asked by
Joe
Top achievements
Rank 2
Iron
Veteran
Iron
Share this question
or