我有一个 ListView,它的项目是一组 RadioButtons,当我从第一个项目中选择一个单选按钮时,ListView 绑定到 100 个字符串的列表,也许是第二个和第三个,一切正常。但是,当我滚动到第 50 个项目时,或者当我在没有出现第一页的任何项目中选择一个单选按钮时,上一页中的第一个项目的选择只是被取消选择,好像列表视图再次呈现了这些项目并且忘记了可能的操纵
<ListView ItemsSource="{Binding}" x:Name="list" VirtualizingStackPanel.VirtualizationMode="Standard">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<RadioButton Template="{StaticResource CheckBoxTemplate2}" Foreground="Orange" Content="Test" Label="YOK" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0,0,0" Canvas.ZIndex="12" FontSize="14" FontWeight="Bold" FontFamily="Advantage-SemiBold" Checked="BetRadioButton_Checked_1" Click="x1_Click" />
<RadioButton x:Name="x2" Template="{StaticResource CheckBoxTemplate2}" Foreground="Orange" Content="Test" Label="YOK" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0,0,0" Canvas.ZIndex="12" FontSize="14" FontWeight="Bold" FontFamily="Advantage-SemiBold" Checked="BetRadioButton_Checked_1" Click="x1_Click" />
<RadioButton x:Name="x3" Template="{StaticResource CheckBoxTemplate2}" Foreground="Orange" Content="Test" Label="YOK" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0,0,0" Canvas.ZIndex="12" FontSize="14" FontWeight="Bold" FontFamily="Advantage-SemiBold" Checked="BetRadioButton_Checked_1" Click="x1_Click" />
<RadioButton x:Name="x4" Template="{StaticResource CheckBoxTemplate2}" Foreground="Orange" Content="Test" Label="YOK" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0,0,0" Canvas.ZIndex="12" FontSize="14" FontWeight="Bold" FontFamily="Advantage-SemiBold" Checked="BetRadioButton_Checked_1" Click="x1_Click" />
<RadioButton x:Name="x5" Template="{StaticResource CheckBoxTemplate2}" Foreground="Orange" Content="Test" Label="YOK" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0,0,0" Canvas.ZIndex="12" FontSize="14" FontWeight="Bold" FontFamily="Advantage-SemiBold" Checked="BetRadioButton_Checked_1" Click="x1_Click" />
<RadioButton x:Name="x6" Template="{StaticResource CheckBoxTemplate2}" Foreground="Orange" Content="Test" Label="YOK" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0,0,0" Canvas.ZIndex="12" FontSize="14" FontWeight="Bold" FontFamily="Advantage-SemiBold" Checked="BetRadioButton_Checked_1" Click="x1_Click" />
<RadioButton x:Name="x7" Template="{StaticResource CheckBoxTemplate2}" Foreground="Orange" Content="Test" Label="YOK" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,0,0,0" Canvas.ZIndex="12" FontSize="14" FontWeight="Bold" FontFamily="Advantage-SemiBold" Checked="BetRadioButton_Checked_1" Click="x1_Click" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
list.DataContext = new List<String>() { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", };