From eb7655ba74fc7f3f450ec83522b91c92cab2100d Mon Sep 17 00:00:00 2001 From: John Stewien Date: Wed, 3 Feb 2021 14:59:35 +1030 Subject: [PATCH] Added performance test that adds 100,000 items to the collection at the press of a button for issue #8 --- .../Controls/DataGridTestControl.xaml | 5 ++++- ExamplesAndTests/DGGroupSortFilterExample/MainWindow.xaml | 2 +- .../ViewModels/DataGridTestViewModel.cs | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ExamplesAndTests/DGGroupSortFilterExample/Controls/DataGridTestControl.xaml b/ExamplesAndTests/DGGroupSortFilterExample/Controls/DataGridTestControl.xaml index 7a91719..8039f84 100644 --- a/ExamplesAndTests/DGGroupSortFilterExample/Controls/DataGridTestControl.xaml +++ b/ExamplesAndTests/DGGroupSortFilterExample/Controls/DataGridTestControl.xaml @@ -29,7 +29,9 @@ + CanUserAddRows="False" + VirtualizingPanel.IsVirtualizing="True" + VirtualizingPanel.IsVirtualizingWhenGrouping="True"> @@ -80,6 +82,7 @@ Checked="CompleteFilter_Changed" Unchecked="CompleteFilter_Changed">Filter completed items Continuously Add Items diff --git a/ExamplesAndTests/DGGroupSortFilterExample/MainWindow.xaml b/ExamplesAndTests/DGGroupSortFilterExample/MainWindow.xaml index 87908ab..21a8da2 100644 --- a/ExamplesAndTests/DGGroupSortFilterExample/MainWindow.xaml +++ b/ExamplesAndTests/DGGroupSortFilterExample/MainWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:DGGroupSortFilterExample.Controls" mc:Ignorable="d" - Title="Editable DataGrid Test" Height="600" Width="600"> + Title="Editable DataGrid Test" Height="600" Width="640"> diff --git a/ExamplesAndTests/DGGroupSortFilterExample/ViewModels/DataGridTestViewModel.cs b/ExamplesAndTests/DGGroupSortFilterExample/ViewModels/DataGridTestViewModel.cs index 0ba8013..a3fde04 100644 --- a/ExamplesAndTests/DGGroupSortFilterExample/ViewModels/DataGridTestViewModel.cs +++ b/ExamplesAndTests/DGGroupSortFilterExample/ViewModels/DataGridTestViewModel.cs @@ -48,8 +48,12 @@ private void AddItemFromTimer(Object stateInfo) TestCollection.Add(ProjectDetails.GetNewProject()); } - private RelayCommandFactory _addRandomItemCommand = new RelayCommandFactory(); - public ICommand AddNewItemCommand => _addRandomItemCommand.GetCommand(() => TestCollection.Add(ProjectDetails.GetNewProject())); + private RelayCommandFactory _add100000ItemsCommand = new RelayCommandFactory(); + public ICommand Add100000ItemsCommand => _add100000ItemsCommand.GetCommand(() => + TestCollection.AddRange(Enumerable.Range(0,100_000).Select(i=>ProjectDetails.GetNewProject()))); + + private RelayCommandFactory _addNewItemCommand = new RelayCommandFactory(); + public ICommand AddNewItemCommand => _addNewItemCommand.GetCommand(() => TestCollection.Add(ProjectDetails.GetNewProject())); private bool _continuouslyAddItems = false; public bool ContinuouslyAddItems