我有Expander
一个CollectionView
. 我尝试在每一行中选择一个单选按钮,但每次滚动多行时,即使未选择该行,也会显示与选中相同的单选按钮。我正在使用 xamarin 表单 5.0.0.1874
这是我的代码
<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>