Exception when clicking on DataGrid

Jun 4, 2009 at 7:24 PM

I have a DataGrid (from WPFToolkit) in my program that, when I click on it, generates an exception: InvalidOperationException - 'EditItem' is not allowed for this view. What on earth is it talking about? The definition for my DataGrid looks like:

                                        <tk:DataGrid Name="InventoryGrid3"

                                         ContextMenu="{StaticResource DataGridColumnContextMenu}"

                                         AlternationCount="2"

                                         HorizontalContentAlignment="Left" 

                                         HorizontalScrollBarVisibility="Visible" 

                                         VerticalScrollBarVisibility="Visible"

                                         ItemsSource="{Binding}"

                                         BorderThickness="0" 

                                         Style="{DynamicResource DataGridDemoStyle}"

                                         CanUserDeleteRows="True"

                                         CanUserAddRows="True"

                                         ColumnWidth="*" 

                                         Initialized="InventoryRowInitializedHandler" 

                                         CellEditEnding="CellEditEndingHandler" 

                                         AutoGenerateColumns="False" 

                                         IsReadOnly="False"

                                         MinRowHeight="22"

                                         LoadingRow="InventoryGrid3_LoadingRow"

                                         HorizontalGridLinesBrush="DarkGray" 

                                         VerticalGridLinesBrush="DarkGray">

 

All of the columns are of type DataGridTextColumn. I tried searching but couldn't find anything about this. Any help would be very much appreciated.  Thanks!

 

Stuart

Jun 5, 2009 at 11:11 AM

What type of Collection are you binding your grid to?

Jun 5, 2009 at 5:56 PM

An IEnumerable class I wrote that contains ~27,000 items. The class holds another class in a list and the properties in the sub-class are all get/set accessible.

 

Stuart