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
139
wrong condition in custom filter
posted

Hi,

If the user opens the Custom Filter Selection, he can enter in nthe operation the (All) operation, that causes strange behavior.

  1. It converts to Infragistics.Windows.DataPresenter.ClearFilterAction.
  2. If you approve the rule (and you can approve it) you get empty filter which everything but (all)
  3. if you reopen the filter you get the above text in the rule.

How can it be solved? How can I remove the (all) from the list?

  • 69686
    posted

    Hello,

    The items in these XamComboEditors are determined runtime as they depend on the type of the fields. Therefore, you will have to remove them when the control is loaded. What you can do is to subscribe for the DropDownOpened event of the xamComboEditor and remove them from there. A simple example :

    void xamDataGrid1_CustomFilterSelectionControlOpening(object sender, CustomFilterSelectionControlOpeningEventArgs e)

            {

                e.Control.AddHandler(XamComboEditor.DropDownOpenedEvent, new RoutedEventHandler(OnDropDownOpened));

            }

     

            public void OnDropDownOpened(object sender, RoutedEventArgs e)

            {

                XamComboEditor editor = (e.OriginalSource as XamComboEditor);

                if (editor != null)

                {

                    ComboBoxItemsProvider provider = editor.ItemsProvider;

                    ObservableCollection<FilterDropDownItem> source = provider.ItemsSource as ObservableCollection<FilterDropDownItem>;

                    if (source.Where(x => x.DisplayText.Contains("All")).Count() > 0)

                    {

                        source.Remove(source.Where(x => x.DisplayText.Contains("All")).FirstOrDefault());

                    }

                }

            }