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
245
Perisisting order of Fixed Columns - not working
posted

I'm using the Infragistics persistence framework to save/load some properties of a XamGrid. Everything works fine except for the order of the fixed columns. It always shows them in the original order of the columns. The order of the non-fixed columns are persisted correctly.

For the grid (defined below), I fix First Name first then then fix ID column and save the persisted layoyut to isolated storage. But when loading from the storage, the grid shows up with ID column as first and First Name as the next column (both are in the fixed state). It should've been First Name first and then ID column. If these columns were not fixed and I just moved the columns around to re-order them, then when I load the grid from the persisted  layout, it shows the columns in the proper order.

My XamGrid code looks like the following

<igGrid:XamGrid x:Name="grid" ItemsSource="{Binding Items}" VerticalAlignment="Top" HorizontalAlignment="Left" Height="350" AutoGenerateColumns="False" ColumnWidth="Auto">

    <ig:PersistenceManager.Settings>

        <ig:PersistenceSettings SavePersistenceOptions="OnlySpecified">             <ig:PersistenceSettings.PropertySettings>

                <ig:PropertyNamePersistenceInfo PropertyName="AllowFixedColumns"></ig:PropertyNamePersistenceInfo>

                <ig:PropertyNamePersistenceInfo PropertyName="IsFixed"></ig:PropertyNamePersistenceInfo>

                <ig:PropertyNamePersistenceInfo PropertyName="AllowSorting"></ig:PropertyNamePersistenceInfo>

                <ig:PropertyNamePersistenceInfo PropertyName="IsSorted"></ig:PropertyNamePersistenceInfo>

                <ig:PropertyNamePersistenceInfo PropertyName="AllowFiltering"></ig:PropertyNamePersistenceInfo>

                <ig:PropertyNamePersistenceInfo PropertyName="PagerSettings.PageSize"></ig:PropertyNamePersistenceInfo>

                <ig:PropertyNamePersistenceInfo PropertyName="ColumnLayouts[].Columns[].Visibility" Options="PropertyPath"></ig:PropertyNamePersistenceInfo>

            </ig:PersistenceSettings.PropertySettings>

        </ig:PersistenceSettings>

    </ig:PersistenceManager.Settings>

    <igGrid:XamGrid.Columns>

        <igGrid:TextColumn Key="ID" HeaderText="ID"></igGrid:TextColumn>

        <igGrid:TextColumn Key="First_Name" HeaderText="First Name"></igGrid:TextColumn>

        <igGrid:TextColumn Key="Last_Name" HeaderText="Last Name"></igGrid:TextColumn>

    </igGrid:XamGrid.Columns>

</igGrid:XamGrid>

  • 8421
    Suggested Answer
    posted

    The reason that the order is not being honored is that the collections of fixed columns, which is where the grid gets the order, is not being persisted. To see the columns persisted in the correct order add the following two lines to your PersistenceSettings.PropertySettings area:

     

    <ig:PropertyNamePersistenceInfo PropertyName="FixedColumnsLeft"/>
    <ig:PropertyNamePersistenceInfo PropertyName="FixedColumnsRight"/>