We are using XamDataGrid whose DataSource is bound to an ObservableCollection. We have also implemented the INotifyPropertyChanged interface. Now on FieldLayoutInitialized event we have created a record filter for a field ( _isDeleted à boolean type) & added the condition in ConditionGroup that if the value is false then show record else filter out. FieldSettings Property ( FilterEvaluationTrigger ) is set to default ( i.e. OnCellValueChange ) & ReevaluateFiltersOnDataChange is set to default ( i.e. true ).
FieldLayoutInitialized event :
private void OnMainDataGirdFieldLayoutInit(object sender, FieldLayoutInitializedEventArgs e)
{
RecordFilter deletedFilter = new RecordFilter(e.FieldLayout.Fields.FirstOrDefault(x => x.Name.Equals("_isDeleted")));
deletedFilter.Conditions.Add(new LogicalDeleteCondition());
e.FieldLayout.RecordFilters.Add(deletedFilter);
}
LogicalDeleteCondition.cs :
public class LogicalDeleteCondition : ICondition
public bool IsMatch(object value, ConditionEvaluationContext context)
return !(bool)value;
public object Clone()
return new LogicalDeleteCondition();
Now when we update this property (_isDeleted ) sometime its work fine (i.e. record hide when set to true ) but sometime its not working. whereas initializerecord event is always triggered. please let me know if i am missing something.
Thanks in advance.
Hello Narender,
You mentioned that the sometimes the record is filtered in/out as expected. In order to investigate the evaluation of the filter you have mentioned I would need additional information:
1. Do you activate or select the record before updating the _isDeleted property that should trigger the filtering?
2. Which is the specific version of the WPF assemblies you are using?
Thank you.
1. I am updating property from backend ( from code ) so, there isn't any activation of record is happening.
2. I am currently using infragicstics 16.2
Hello Narender,I have put together a sample project based on the code snippets you have shared. On button click the third item of the data source is updated so that the _isDeleted property value changes. The record is filtered in/out based on the current value. If the user selects the third record when it is visible and then click the button to update the _isDeleted value the record is stays in view. This behavior is already fix internally and will be available in the next service release which is scheduled for the end of the month. The best option to assist you further on this if the selection/activation of the records is not your scenario is if the issue is reproducible within a sample project. Please feel free to modify the attached project or share your sample which illustrates the behavior.Let me know if you have any questions.
Thanks Maria. in my case back end services are continuously pushing data in XamDataGrid DataSource (ObservableCollection). (i.e either insert new record,update or delete record ). as i have test it in debug mode and found that if 2500 records are deleted so approx 2460 events got reflected on UI ( i.e got hidden as per the filter ) but 40 still left out. can you please let me know the sequence of events triggered by XamDatagrid once the datasource property is updated.
From your last response I see that you are operating with the data source collection by adding and removing items rather than just updating an item property. I have tested this scenario on my side and all records were shown accordingly. The best way for us to assist you is if you provide a small isolated sample that we can run and use for debugging locally.