protected override void RestoreStateCore(IDataGridContextVisitable dataGridContextVisitable)
        {
            try
            {
                m_rootDataGridContext = SaveRestoreDataGridContextStateVisitor.GetDataGridContextFromVisitable(dataGridContextVisitable);

                if (m_saveExpandedItems)
                {
                    for (int i = 0; i < m_itemsToExpand.Count; i++)
                    {
                        object dataItemToExpand = m_itemsToExpand[i].Target;

                        if (dataItemToExpand != null)
                        {
                            try
                            {
                                // Verify if we have a System.Data.DataView as ItemsSource to
                                // ensure to restore the System.Data.DataRowView that represents
                                // the System.Data.DataRow saved previously
                                System.Data.DataView dataView =
                                    ItemsSourceHelper.TryGetDataViewFromDataGridContext(m_rootDataGridContext);

                                if ((dataView != null) &&
                                    (dataItemToExpand is System.Data.DataRow))
                                {
                                    foreach (System.Data.DataRowView dataRowView in dataView)
                                    {
                                        if (dataRowView.Row == dataItemToExpand)
                                        {
                                            dataItemToExpand = dataRowView;
                                            break;
                                        }
                                    }
                                }

                                m_rootDataGridContext.ExpandDetails(dataItemToExpand);
                            }
                            catch
                            {
                                System.Diagnostics.Debug.Assert(false, "Item has moved in the source ?");
                            }
                        }
                    }
                }

                bool visitWasStopped;
                dataGridContextVisitable.AcceptVisitor(0, int.MaxValue, this, DataGridContextVisitorType.Groups, false, out visitWasStopped);
            }
            finally
            {
                m_itemsToExpand       = null;
                m_rootDataGridContext = null;
            }
        }