Skip to content

Commit

Permalink
Added performance test that adds 100,000 items to the collection at t…
Browse files Browse the repository at this point in the history
…he press of a button for issue #8
  • Loading branch information
stewienj committed Feb 3, 2021
1 parent c594ea3 commit eb7655b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
</Grid.RowDefinitions>
<DataGrid x:Name="dataGrid1"
ItemsSource="{Binding Source={StaticResource cvsTasks}}"
CanUserAddRows="False">
CanUserAddRows="False"
VirtualizingPanel.IsVirtualizing="True"
VirtualizingPanel.IsVirtualizingWhenGrouping="True">
<DataGrid.GroupStyle>
<!-- Style for groups at top level. -->
<GroupStyle>
Expand Down Expand Up @@ -80,6 +82,7 @@
Checked="CompleteFilter_Changed" Unchecked="CompleteFilter_Changed">Filter completed items</CheckBox>
<Button Content="Remove Groups" Margin="10,2,2,2" Click="UngroupButton_Click" />
<Button Content="Group by Project/Status" Margin="2" Click="GroupButton_Click" />
<Button Command="{Binding Add100000ItemsCommand}">Add 100,000 Items</Button>
<CheckBox VerticalAlignment="Center" IsChecked="{Binding ContinuouslyAddItems}" Grid.Column="0">Continuously Add Items</CheckBox>
</StackPanel>
</Grid>
Expand Down
2 changes: 1 addition & 1 deletion ExamplesAndTests/DGGroupSortFilterExample/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<Grid>
<local:DataGridTestControl/>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit eb7655b

Please sign in to comment.