I seem to be having a strange problem with the PropertyGrid when using the VirtualizingStackPanel class. The propertygrid is inside a Grid, which itself is inside a (actipro) wizard page (see below):
<wizard:WizardPage x:Name="msmFSPPage" PageType="Interior"
Caption="Flexcomm System Configuration Parameters"
Description="This page contains the Parameters necessry to configuration Flexcomm System"
Title="Flexcomm System Configuration Parameters Page"
HelpButtonVisible="False"
NextButtonEnabled="{Binding Path=FlexCommSysData.P25CapableSystem}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Content="Configuration Name" Height="23.277" VerticalAlignment="Top" />
<TextBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2"
MaxLines="1" Margin="-75,0,0,0" HorizontalAlignment="Stretch" Width="Auto"
Text="{Binding Path=FlexCommSysData.Name}"/>
<propgrid:PropertyGrid Name="fctSysDataPG" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2"
Width="Auto" Height="450"
IsSummaryVisible="True"
propgrid:PropertyGrid.IsAsynchronous="False"
<!-- VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" -->
SelectedObject="{Binding Path=FlexCommSysData}">
<propgrid:PropertyGrid.Resources>
<Style x:Key="{x:Type propgrid:PropertyGridDataAccessorItem}" TargetType="{x:Type propgrid:PropertyGridDataAccessorItem}"
BasedOn="{StaticResource fctSysDataPgStyle}" />
</propgrid:PropertyGrid.Resources>
<propgrid:PropertyGrid.DataFactory>
<RpWin:CustomDataFactory />
</propgrid:PropertyGrid.DataFactory>
</propgrid:PropertyGrid>
</Grid>
</wizard:WizardPage>
The problem is that when anything is modified on the wizard page, when 'Next' is clicked to go onto the next page the dialog box this is all in throws a whole bunch of exceptions (which in this particular application pop up as little windows) saying "Specified argument was out of range of valid values. Parameter name: index".
It actually continues throwing them, filling the screen with little windows, until you kill the application. Removing the VirtualizingStackPanel line (that I've commented out above) resolves the issue and everything works as expected. I don't know if this is something I'm doing wrong or some sort of bug in the propertygrid. There really aren't very many entries in any of these wizard pages, so there's probably not much to be gained by virtualizing anyways, but it'd be nice to know what's causing this. Thanks!