Posted 19 January 2021, 10:01 pm EST
Hello Support-Team,
I updatet the C1DataGrid to the newest Version 2020v3.
Now I’m facing a problem while saving and loading the filterstate of the columns.
This worked in older versions without any problem.
For saving the state I’m using the following Code. This works without an error.
public override void SafeFilterState()
{
filteredColumns?.Clear();
foreach (var filteredCol in dgPrototypes.FilteredColumns)
{
try
{
filteredColumns.Add(filteredCol.Name, filteredCol.FilterState);
}
catch (Exception exc)
{
LogHandling.Logger.Error(exc);
}
}
}
But Loading the filterstates with the following code leads to an error.
I uploaded the complete Errormessage with this post.
public override void LoadFilterState()
{
List<DataGridColumnValue<DataGridFilterState>> filterList = new List<DataGridColumnValue<DataGridFilterState>>();
try
{
foreach (var filteredColumn in filteredColumns)
{
foreach (var datagridColumn in dgPrototypes.Columns)
{
if (datagridColumn.Name == filteredColumn.Key)
{
//filterList.Add(new KeyValuePair<C1.WPF.DataGrid.DataGridColumn, DataGridFilterState>(datagridColumn, filteredColumn.FilterState));
filterList.Add(new DataGridColumnValue<DataGridFilterState>(datagridColumn, filteredColumn.Value));
}
}
}
if (filterList.Count > 0)
{
dgPrototypes.FilterBy(filterList.ToArray());
}
}
catch (Exception exc)
{
LogHandling.Logger.Error(exc);
}
}