Skip to main content

AccordionControl.CustomItemFilter Event

Occurs when the AccordionControl is about to be filtered.

Namespace: DevExpress.Xpf.Accordion

Assembly: DevExpress.Xpf.Accordion.v24.1.dll

NuGet Package: DevExpress.Wpf.Accordion

Declaration

public event EventHandler<AccordionCustomItemFilterEventArgs> CustomItemFilter

Event Data

The CustomItemFilter event's data class is AccordionCustomItemFilterEventArgs. The following properties provide information specific to this event:

Property Description
Accepted Gets or sets a value indicating whether the currently processed item is included in the results.
Accordion Gets the AccordionControl whose items are being filtered.
Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
Item Gets the currently processed Accordion item.
OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
SearchText Gets the search criteria.
Source Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.

The event data class exposes the following methods:

Method Description
InvokeEventHandler(Delegate, Object) When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation. Inherited from RoutedEventArgs.
OnSetSource(Object) When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes. Inherited from RoutedEventArgs.
PassesFilter(String) Checks whether the specified string meets filter criteria.

Remarks

You can handle the CustomItemFilter event to customize the AccordionControl‘s filtering logic.

The following code sample shows how to exclude an accordion item from the search result:

<dxa:AccordionControl ShowSearchControl="True" CustomItemFilter="OnCustomItemFilter">
   <dxa:AccordionItem Header="Item1" Glyph="{dx:DXImage Image=Image_32x32.png}"/>
   <dxa:AccordionItem Header="Item2" Glyph="{dx:DXImage Image=Map_32x32.png}"/>
   <dxa:AccordionItem Header="Item3" Glyph="{dx:DXImage Image=Image_32x32.png}"/>
</dxa:AccordionControl>
void OnCustomItemFilter(object sender, AccordionCustomItemFilterEventArgs e) {
   if(((AccordionItem)e.Item).Header.ToString() == "Item1") {
      e.Accepted = false;
   }
}

The image below shows the result:

AccordionSearchCustom

Refer to the Searching topic to learn more.

See Also