Quantcast
Viewing all articles
Browse latest Browse all 7205

How to provide custom filter functionality for TokenEdit

This example demonstrates how to implement the CustomFilterTokens event that can be used for custom filtering of tokens in TokenEdit's dropdown. To accomplish this task, create a custom TokenEdit descendant and override the following methods.
1. Override TokenEdit's CreatePopupController method to create a custom TokenEditTokenListPopupController descendant.
2. In the custom TokenEditTokenListPopupController descendant, override the UpdateFilter method to clear the default filter.
3. Override TokenEdit's CreatePopupForm method to create a custom TokenEditPopupForm descendant.
4. Override a custom TokenEditPopupForm descendant's CreateDropDownControl method to create a custom DefaultTokenEditDropDownControl descendant.
5. Override a DefaultTokenEditDropDownControl descendant's SetDataSource method in order to raise the CustomFilterTokens event.

Here is a small sample of how to use this functionality:

[C#]
//Enable custom filter functionality this.tokenEdit1.Properties.UseCustomFilter=true;//Handle the eventthis.tokenEdit1.Properties.CustomFilterTokens=newEventHandler<MyFilterEventArgs>(TokenEdit_CustomFilterText); privatevoidTokenEdit_CustomFilterText(objectsender,MyFilterEventArgse){if(condition)e.IsValidToken=true;}
[VB.NET]
'Enable custom filter functionality Me.tokenEdit1.Properties.UseCustomFilter = true'Handle the eventMe.tokenEdit1.Properties.CustomFilterTokens = AddressOfMe.TokenEdit_CustomFilterTextPrivateSub TokenEdit_CustomFilterText(ByVal sender AsObject, ByVal e As MyFilterEventArgs)If condition Then e.IsValidToken = trueEndIfEndSub

 


Viewing all articles
Browse latest Browse all 7205

Trending Articles