0

我的应用程序的用户报告了应用程序中的数据网格问题:

有时,当他想选择一个条目时,会选择更多条目(虽然不是连续选择,他发送了一个屏幕截图) - 但是,我根本无法重现这一点。

这是我的数据网格的声明:

<DataGrid x:Name="mGlossaryGrid" ItemsSource="{Binding GlossaryItems}"   AutoGenerateColumns="False"
                                  HeadersVisibility="None" GridLinesVisibility="None" IsSynchronizedWithCurrentItem="True"
                          SelectionMode="Single" SelectionUnit="FullRow" IsReadOnly="True" KeyboardNavigation.DirectionalNavigation="Cycle"
                                  ScrollViewer.HorizontalScrollBarVisibility="Hidden"
                                  SelectedCellsChanged="mGlossaryGrid_SelectedCellsChanged_1">



private void mGlossaryGrid_SelectedCellsChanged_1(object sender, SelectedCellsChangedEventArgs e)
    {
        try
        {
            var cell = e.AddedCells.First();
            mGlossaryGrid.ScrollIntoView(cell.Item);
        }
        catch
        {
        }
    }

有谁知道是什么导致了这个错误?

谢谢你的回答

4

1 回答 1

0

作为一种猜测,我会假设它们被作为重复项进行相等性测试,因此由于存在数据(或参考?)相等性,因此它们被认为是相同的并被选中。检查所选数据的相似性并寻找趋势。

于 2012-10-08T19:57:55.360 回答