I am trying to persist filters but having no luck.
on cell double click it redirects to a detail page, when navigating back i would like to keep the filters in which the user had prior to leaving the page.
I have this event i am calling on double click:
private void AuditXamGrid_CellDoubleClicked(object sender, Infragistics.Controls.Grids.CellClickedEventArgs e) { var TheCell = AuditXamGrid.ActiveCell; if (TheCell == null) return; var data = TheCell.Row.Data; if (data is GetSummaryAuditResult) { var rowdata = data as GetSummaryAuditResult; PersistenceSettings gridSettings = new PersistenceSettings(); gridSettings.SavePersistenceOptions = PersistenceOption.OnlySpecified;
PropertyNamePersistenceInfo pnpi = new PropertyNamePersistenceInfo(); pnpi.PropertyName = "Columns[].FilterColumnSettings"; pnpi.Options = PropertyNamePersistenceOptions.Contains; gridSettings.PropertySettings.Add(pnpi); MemoryStream ms; ms = PersistenceManager.Save(AuditXamGrid, gridSettings); ViewModel.AppViewModel.AuditFilterSettings = ms.ToArray(); NavigationService.Navigate(new Uri("/AuditDetails?AuditID=" + rowdata.AuditID + "&MatchID=" + rowdata.MatchID + "&PackageID=" + rowdata.PackageID + "&Perner=" + rowdata.Perner, UriKind.Relative)); } } When is gets to the saving the setting i get a stack over flow exception and i just cant get around it.
here is my Grid:
< ig:XamGrid CellDoubleClicked="AuditXamGrid_CellDoubleClicked" FontSize="10" FontFamily="Verdana" Background="#44FFFFFF" HeaderRowHeight="40" x:Name="AuditXamGrid" Height="Auto" RowHeight="25" ItemsSource="{Binding Source={StaticResource ViewModel}, Path=Audits}" AutoGenerateColumns="False" IsAlternateRowsEnabled="True" HorizontalAlignment="Left" VerticalAlignment="Top" Width="Auto"> <ig:XamGrid.FilteringSettings> <ig:FilteringSettings FilteringScope="ColumnLayout" AllowFiltering="FilterRowTop" AllowFilterRow="Top" IsOnCellActiveEditingEnabled="False" IsMouseActionEditingEnabled="SingleClick" /> </ig:XamGrid.FilteringSettings> <!-- Grid Columns --> <ig:XamGrid.Columns> <ig:TextColumn Key="AuditID" IsReadOnly="True" Visibility="Collapsed"/> <ig:TextColumn Key="MatchID" IsReadOnly="True" Visibility="Collapsed"/> <!--<ig:TextColumn Key="PackageID" IsReadOnly="True" Visibility="Collapsed"/>--> <ig:TextColumn Key="PackageID" IsReadOnly="True" HeaderText="Order #"/> <ig:TextColumn Key="BusinessUnit" IsReadOnly="True" HeaderText="Site"/> <ig:TextColumn Key="Perner" IsReadOnly="True" HeaderText="Pernr"/> <ig:TextColumn Key="Name" IsReadOnly="True" HeaderText="Employee Name"/> <ig:TextColumn Key="HireDate" FormatString="{}{0:d}" IsReadOnly="True" HeaderText="Hire Date"/> <ig:TextColumn Key="User" IsReadOnly="True" HeaderText="Requested By"/> <ig:TextColumn Key="UserName" IsReadOnly="True" HeaderText="Requested By Name"/> <ig:TextColumn Key="EmployeeText" IsReadOnly="True" HeaderText="EE Group"/> <ig:TextColumn Key="OverAllScore" IsReadOnly="True" IsSorted="Descending" HeaderText="Overall Score"/> <ig:TextColumn Key="AuditAppUserID" IsReadOnly="True" HeaderText="EAS Agent Working"/> <ig:TextColumn Key="DateOpen" FormatString="{}{0:d}" IsSorted="Descending" IsReadOnly="True" HeaderText="Audit Opened"/> <ig:TextColumn Key="DateClosed" FormatString="{}{0:d}" IsReadOnly="True" HeaderText="Audit Closed"/> </ig:XamGrid.Columns> </ig:XamGrid> Help Please.
<
ig:XamGrid
CellDoubleClicked="AuditXamGrid_CellDoubleClicked"
FontSize="10"
FontFamily="Verdana"
Background="#44FFFFFF"
HeaderRowHeight="40"
x:Name="AuditXamGrid"
Height="Auto"
RowHeight="25"
ItemsSource="{Binding Source={StaticResource ViewModel}, Path=Audits}"
AutoGenerateColumns="False"
IsAlternateRowsEnabled="True"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Width="Auto">
<ig:XamGrid.FilteringSettings>
<ig:FilteringSettings FilteringScope="ColumnLayout" AllowFiltering="FilterRowTop" AllowFilterRow="Top" IsOnCellActiveEditingEnabled="False" IsMouseActionEditingEnabled="SingleClick" />
</ig:XamGrid.FilteringSettings>
<!-- Grid Columns -->
<ig:XamGrid.Columns>
<ig:TextColumn Key="AuditID" IsReadOnly="True" Visibility="Collapsed"/>
<ig:TextColumn Key="MatchID" IsReadOnly="True" Visibility="Collapsed"/>
<!--<ig:TextColumn Key="PackageID" IsReadOnly="True" Visibility="Collapsed"/>-->
<ig:TextColumn Key="PackageID" IsReadOnly="True" HeaderText="Order #"/>
<ig:TextColumn Key="BusinessUnit" IsReadOnly="True" HeaderText="Site"/>
<ig:TextColumn Key="Perner" IsReadOnly="True" HeaderText="Pernr"/>
<ig:TextColumn Key="Name" IsReadOnly="True" HeaderText="Employee Name"/>
<ig:TextColumn Key="HireDate" FormatString="{}{0:d}" IsReadOnly="True" HeaderText="Hire Date"/>
<ig:TextColumn Key="User" IsReadOnly="True" HeaderText="Requested By"/>
<ig:TextColumn Key="UserName" IsReadOnly="True" HeaderText="Requested By Name"/>
<ig:TextColumn Key="EmployeeText" IsReadOnly="True" HeaderText="EE Group"/>
<ig:TextColumn Key="OverAllScore" IsReadOnly="True" IsSorted="Descending" HeaderText="Overall Score"/>
<ig:TextColumn Key="AuditAppUserID" IsReadOnly="True" HeaderText="EAS Agent Working"/>
<ig:TextColumn Key="DateOpen" FormatString="{}{0:d}" IsSorted="Descending" IsReadOnly="True" HeaderText="Audit Opened"/>
<ig:TextColumn Key="DateClosed" FormatString="{}{0:d}" IsReadOnly="True" HeaderText="Audit Closed"/>
</ig:XamGrid.Columns>
</ig:XamGrid>
Ben
Hello,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
Hello Ben,
Thank you for your post. I have been looking into it, but it seems like I am missing something about your scenario, so if this is still an issue for you, could you please send me an isolated sample project, where this is reproduced, so I can investigate it further for you.
Looking forward for your reply.
UPDATE:
I got it to save to a byt array, its 3megs which seesms big but atleast it works. Unfortunetly I get the same stack overflow exception when trying to load the filter info, I have the load process on the grid loaded event:
private void AuditXamGrid_Loaded(object sender, RoutedEventArgs e) { PersistenceSettings gridSettings = new PersistenceSettings(); //gridSettings.SavePersistenceOptions = PersistenceOption.AllButIgnored; gridSettings.LoadPersistenceOptions = PersistenceOption.AllButIgnored; PropertyNamePersistenceInfo pnpi = new PropertyNamePersistenceInfo(); pnpi.PropertyName = "Columns[].FilterColumnSettings"; pnpi.Options = PropertyNamePersistenceOptions.Contains; gridSettings.PropertySettings.Add(pnpi); AuditXamGrid.FilteringSettings.FilteringScope = FilteringScope.ColumnLayout; if (ViewModel.AppViewModel.AuditFilterSettings != null) { MemoryStream memstream = new MemoryStream(ViewModel.AppViewModel.AuditFilterSettings); PersistenceManager.Load(AuditXamGrid, memstream, gridSettings); } }
I have tried everything i can to get this to work, this issue is under a tight time constraint, please help