'Declaration Public ReadOnly Property Tools As IList(Of FilterTool)
public IList<FilterTool> Tools {get;}
Imports Infragistics.Win Imports Infragistics.Win.SupportDialogs.FilterUIProvider Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Dim menuSettings As FilterUIProviderMenuSettings = Me.ultraGridFilterUIProvider1.MenuSettings ' Set the default appearance of all tools that are shown by the provider to have a blue background menuSettings.ToolAppearance.BackColor = Color.Blue ' Show a checked item with a gray background. menuSettings.CheckedAppearance.BackColor = Color.Gray End Sub Private Sub ultraGridFilterUIProvider1_AfterMenuPopulate(ByVal sender As Object, ByVal e As Infragistics.Win.SupportDialogs.FilterUIProvider.AfterMenuPopulateEventArgs) ' Do unique processing for the tools that are on the root level of the menu For Each tool As FilterTool In e.MenuItems ' Instead of the default gray background on a checked item, have any checked items ' on the root level have a red background. If tool.Checked Then tool.CheckedAppearance.BackColor = Color.Red End If Dim treeTool As FilterTreeTool = TryCast(tool, FilterTreeTool) If treeTool IsNot Nothing Then ' Set the tree to only drill down as far as the month of the date. This differs ' from setting the DateHierarchyLevel on the FilterUIProviderTreeSettings in that ' that setting will apply to all menus that the provider shows (as it can be ' associated with multiple grids), while setting the property here allows ' a more precise control over each instance. treeTool.DateHierarchyLevel = DateHierarchyLevel.Month Else ' Process any child menu items Dim menuTool As FilterMenuTool = TryCast(tool, FilterMenuTool) If menuTool IsNot Nothing Then Me.AfterMenuPopulateHelper(menuTool.Tools) End If End If Next End Sub Private Sub AfterMenuPopulateHelper(ByVal tools As IList(Of FilterTool)) ' Prepend the index of each tool to the displayed text For i As Integer = 0 To tools.Count - 1 Dim tool As FilterTool = tools(i) tool.DisplayText = String.Format("{0} - {1}", i, tool.DisplayText) ' If the item is the first item in the group, bold the text if (i = 0 Or tool.IsFirstInGroup) tool.Appearance.FontData.Bold = DefaultableBoolean.True ' Do this recursively for any other menu tools Dim menuTool As FilterMenuTool = TryCast(tool, FilterMenuTool) If menuTool IsNot Nothing Then Me.AfterMenuPopulateHelper(menuTool.Tools) End If Next End Sub
using Infragistics.Win; using Infragistics.Win.SupportDialogs.FilterUIProvider; private void Form1_Load(object sender, EventArgs e) { FilterUIProviderMenuSettings menuSettings = this.ultraGridFilterUIProvider1.MenuSettings; // Set the default appearance of all tools that are shown by the provider to have a blue background menuSettings.ToolAppearance.BackColor = Color.Blue; // Show a checked item with a gray background. menuSettings.CheckedAppearance.BackColor = Color.Gray; } private void ultraGridFilterUIProvider1_AfterMenuPopulate(object sender, Infragistics.Win.SupportDialogs.FilterUIProvider.AfterMenuPopulateEventArgs e) { // Do unique processing for the tools that are on the root level of the menu foreach (FilterTool tool in e.MenuItems) { // Instead of the default gray background on a checked item, have any checked items // on the root level have a red background. if (tool.Checked) tool.CheckedAppearance.BackColor = Color.Red; FilterTreeTool treeTool = tool as FilterTreeTool; if (treeTool != null) { // Set the tree to only drill down as far as the month of the date. This differs // from setting the DateHierarchyLevel on the FilterUIProviderTreeSettings in that // that setting will apply to all menus that the provider shows (as it can be // associated with multiple grids), while setting the property here allows // a more precise control over each instance. treeTool.DateHierarchyLevel = DateHierarchyLevel.Month; } else { // Process any child menu items FilterMenuTool menuTool = tool as FilterMenuTool; if (menuTool != null) this.AfterMenuPopulateHelper(menuTool.Tools); } } } private void AfterMenuPopulateHelper(IList<FilterTool> tools) { // Prepend the index of each tool to the displayed text for (int i = 0; i < tools.Count; i++) { FilterTool tool = tools[i]; tool.DisplayText = String.Format("{0} - {1}", i, tool.DisplayText); // If the item is the first item in the group, bold the text if (i == 0 || tool.IsFirstInGroup) tool.Appearance.FontData.Bold = DefaultableBoolean.True; // Do this recursively for any other menu tools FilterMenuTool menuTool = tool as FilterMenuTool; if (menuTool != null) this.AfterMenuPopulateHelper(menuTool.Tools); } }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2