Expander in a CollectionView not properly updating the screen in xamarin

949 Views Asked by At

I have an Expander in a CollectionView. I try to select a radio button in every row but everytime I scroll multiple rows displaying the same radio button as selected even though the row is not selected. I am using xamarin forms 5.0.0.1874

here is my code

<CollectionView ItemsSource="{Binding sI_Refill_s}">
         <CollectionView.ItemTemplate>
             <DataTemplate>
                  <yummy:PancakeView CornerRadius="10" BackgroundColor="{StaticResource GreenColor}" Padding="10">
                    <xct:Expander IsExpanded="{Binding IsEnable}">
                        <xct:Expander.Header>
                             <Grid RowDefinitions="Auto,Auto" ColumnDefinitions="*,*,*" RowSpacing="10" Padding="05">
                                <!--ROW1-->
                                <Label Grid.Row="0" Grid.Column="0"  Text="Last" Style="{StaticResource headerStyle}"/>
                                <Label Grid.Row="0" Grid.Column="1"  Text="DOB" Style="{StaticResource headerStyle}"/>
                                <Label Grid.Row="0" Grid.Column="2"  Text="Reason" Style="{StaticResource headerStyle}"/>

                                <!--ROW2-->
                                <Label Grid.Row="1" Grid.Column="0"  Text="{Binding Last}" Style="{StaticResource ValStyle}"/>
                                <Label Grid.Row="1" Grid.Column="1"  Text="{Binding DOB}" Style="{StaticResource ValStyle}"/>
                                <Entry Grid.Row="1" Grid.Column="2"  Text="{Binding Reason, Mode=TwoWay}" HorizontalOptions="Fill" Style="{StaticResource ValStyle}"/>
                              </Grid>
                        </xct:Expander.Header>
                        <xct:Expander.ContentTemplate>
                            <DataTemplate>
                                <Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto" ColumnDefinitions="*,*,*,*,*" RowSpacing="10">

                                    <!--ROW3-->
                                    <Label Grid.Row="0" Grid.Column="0" Text="First" Style="{StaticResource headerStyle}"/>
                                    <Label Grid.Row="0" Grid.Column="1" Text="L_DISP_DT" Style="{StaticResource headerStyle}"/>
                                    <Label Grid.Row="0" Grid.Column="2" Text="REM_INJS" Style="{StaticResource headerStyle}"/>
                                    <Label Grid.Row="0" Grid.Column="3" Text="STATUS" Style="{StaticResource headerStyle}"/>
                                    <Label Grid.Row="0" Grid.Column="4" Text="Refill#" Style="{StaticResource headerStyle}"/>
                                     <!--ROW4-->
                                    <Label Grid.Row="1" Grid.Column="0" Text="{Binding First}" Style="{StaticResource ValStyle}"/>
                                    <Label Grid.Row="1" Grid.Column="1" Text="{Binding L_Disp_Dt}" Style="{StaticResource ValStyle}"/>
                                    <Label Grid.Row="1" Grid.Column="2" Text="{Binding Rem_injs}" Style="{StaticResource ValStyle}"/>
                                    <Label Grid.Row="1" Grid.Column="3" Text="{Binding Status}" Style="{StaticResource ValStyle}"/>
                                    <Label Grid.Row="1" Grid.Column="4" Text="{Binding RefillNo}" Style="{StaticResource ValStyle}"/>
                                     <!--ROW5-->
                                    <Label Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="5" Text="Decision" Style="{StaticResource headerStyle}"/>
                                    <!--ROW6-->
                                    <StackLayout Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="5"
                                                 RadioButtonGroup.GroupName="{Binding groupName}"
                                                 RadioButtonGroup.SelectedValue="{Binding SelectedItem}" Orientation="Horizontal" HorizontalOptions="Center">
                                        <RadioButton Content="Approved"
                                                     Value="Approved" FontSize="Micro"/>
                                        <RadioButton Content="Hold"
                                                     Value="Hold" FontSize="Micro"/>
                                        <RadioButton Content="Reject"
                                                     Value="Reject" FontSize="Micro"/>
                                    </StackLayout>

                                    
                                </Grid>
                            </DataTemplate>
                        </xct:Expander.ContentTemplate>
                    </xct:Expander>
                </yummy:PancakeView>
             </DataTemplate>
         </CollectionView.ItemTemplate>
         </CollectionView>
1

There are 1 best solutions below

0
On

If you are targeting iOS then it is likely to be XamarinCommunityToolkit bug you can follow it status/progress in:

Expander within CollectionView does not work properly on iOS #608

Expander is not expanding and collapsing properly when load in CollectionView #572