Posted 19 May 2020, 9:03 pm EST - Updated 3 October 2022, 1:25 pm EST
Hi C1,
a customer wants fo filter datetime values in a FlexGrid column by day of week. I found a way to reuse the existing datetime filter and extend it with a “Day of week” filter, see attached sample and screenshot:
I did so by implementing a “IC1ColumnFilter” which encapsulates a “ColumnFilter” and also has additional properties for the weekday filter.
In the UI, I added two radiobuttons to toggle beetween standard filter and weekday filter. Here comes the ugly part: in order to use the default filter control, I had to use reflection, because the type “ColumnFilterEditor” is internal:
string strAssembly = typeof(IC1ColumnFilterEditor).Assembly.GetName().Name;
Type typeColFilterEditor = Type.GetType("C1.Win.C1FlexGrid.ColumnFilterEditor," + strAssembly, true);
IC1ColumnFilterEditor filterEditorDefault = (IC1ColumnFilterEditor) Activator.CreateInstance(typeColFilterEditor);
But I don’t like this UI, because there are two places where you switch beetween filters:
-my two radiobuttons
-the buttons “Value filter”/“Conditional filter” in the standard filter.
Is there any chance to extend/subclass the “ColumnFilterEditor” so that I can add a third toggle button “weekday” to the ToolStrip which shows my custom panel “day of week”?
Probably this is a question for the developers, as the API would have to be enhanced.
And please make “ColumnFilterEditor” a public class so I can instanciate it ;-).
Best regards
Wolfgang