Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
390
StackOverflowException with PersistenceManager using XamDataGrid
posted

Hello!  I am trying to use the PersistenceManager to save the state of an XamDataGrid, but keep getting a StackOverflowException when I try to load the persisted state.

This seems to be a recurring issue:

http://www.infragistics.com/community/forums/p/69561/352475.aspx

http://www.infragistics.com/community/forums/t/63391.aspx

One of the posts suggested the SaveCustomization/LoadCustomization methods, but they don't appear to store all the group expanded/collapsed information, which is what I was hoping to achieve.

Thanks, Ed

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:igWPF="http://schemas.infragistics.com/xaml/wpf"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="20" />
        </Grid.RowDefinitions>
        <igWPF:XamDataGrid x:Name="DataGrid" Grid.Row="0" BindToSampleData="True" />
        <Button x:Name="Button" Grid.Row="1" Content="Persist" />
    </Grid>
</Window>

 public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            this.Button.Command = new DelegateCommand<XamDataGrid>(PersistState);
            this.Button.CommandParameter = this.DataGrid;
        }

        public void PersistState(XamDataGrid grid)
        {
            MemoryStream ms = PersistenceManager.Save(grid);

            PersistenceManager.Load(grid, ms);  //StackOverflowException here
        }
    }