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
60
sometime Record Filter is not evaluating
posted

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.