3 つの異なるグループごとに異なるプレーヤーを参照するために、3 つの異なるコントロール (ListBoxes) にバインドされた、通った大学、プレーするポジション、および現在のチームを含むスポーツ プレーヤーのメモリ内コレクションがあるとします。
3 つのコントロールを異なる ICollectionViews と同期して、1 つの選択が他のコントロールと同期されるようにすることは可能ですか? それとも、それらがすべて同じ ICollectionView インスタンスにバインドされている場合にのみ可能ですか? 3 つの ListBoxes が既に IsSynchronizedWithCurrentItem="true" に設定されていますが、これは同じ ICollectionView を使用している場合にのみ機能すると思われますか?
これは私が私のコードでやっていることです:
ICollectionView collegeView = new ListCollectionView(playerDatabase);
collegeView.GroupDescriptions.Add(new PropertyGroupDescription("CollegeName"));
collegeView.SortDescriptions.Add(new SortDescription("CollegeName", ListSortDirection.Ascending));
collegeView.SortDescriptions.Add(new SortDescription("FirstName", ListSortDirection.Ascending));
lstCollege.ItemsSource = collegeView;
ICollectionView positionView = new ListCollectionView(playerDatabase);
positionView.GroupDescriptions.Add(new PropertyGroupDescription("PositionCode", new NFLPositionGrouper()));
positionView.SortDescriptions.Add(new SortDescription("PositionName", ListSortDirection.Ascending));
positionView.SortDescriptions.Add(new SortDescription("FirstName", ListSortDirection.Ascending));
playerDatabase 変数は、匿名型を投影する LINQ to Entity クエリから取得されます。
ところで、元のデータベースには約 2000 行あります。最初のインターフェイスが最初に自分自身を描画するのに 1 秒かかるようです。これをより効率的に行う方法は他にありますか? ControlTemplate を置き換えて VirtualizingStackPanel を削除しない限り (ただし、ItemTemplate と HeaderTemplate 用の DataTemplates はあります)、アイテムの仮想化を意図せずに無効にすることはありませんか?