This is a migrated thread and some comments may be shown as answers.
how change font available filers in FilterPopup
9 Answers 7 Views
This is a migrated thread and some comments may be shown as answers.
moj
Top achievements
Rank 1
moj asked on 26 Feb 2021, 05:36 AM

hi

i can change font FilterPopup but font "available filers" not changes

This section is marked in the photo below

 

9 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 26 Feb 2021, 06:21 AM

Hello, Мoj,

I have prepared a sample code snippet demonstrating how to change the font for the menu items in the Excel-like filter popup:

        public RadForm1()
        {
            InitializeComponent();

            this.radGridView1.EnableFiltering = true;
            this.radGridView1.ShowHeaderCellButtons = true;
            this.radGridView1.FilterPopupInitialized+=radGridView1_FilterPopupInitialized;
        }

        Font f = new Font("Arial", 12f, FontStyle.Italic );
        private void radGridView1_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e)
        {
            RadListFilterPopup popup = e.FilterPopup as RadListFilterPopup;
            if (popup!=null)
            {
                popup.Font = f;
                foreach (RadItem item in popup.Items)
                {
                    item.Font = f;
                    RadMenuItem menuItem= item as RadMenuItem;
                    if (menuItem!=null && menuItem.Items.Count>0)
                    {
                        foreach (RadItem childItem in menuItem.Items)
                        {
                            childItem.Font = f;
                        }
                    }
                }
                popup.MenuTreeElement.TreeView.NodeFormatting-=TreeView_NodeFormatting;
                popup.MenuTreeElement.TreeView.NodeFormatting+=TreeView_NodeFormatting;

              
            }
        }

        private void TreeView_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
        {
            e.NodeElement.Font = f;
        }

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
moj
Top achievements
Rank 1
answered on 27 Feb 2021, 03:49 AM

hello Dess

very thanks

I also want to change the font of the "filter dialog"

 

0
moj
Top achievements
Rank 1
answered on 27 Feb 2021, 04:07 AM
I also want to RightToLeft "filter dialog"
0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 01 Mar 2021, 10:31 AM
Hello, Мoj,

According to the provided screenshots, it seems that you want to customize the composite filter dialog. Note that you have access to the dialog via the RadGridView.CreateCompositeFilterDialog event. You can change the font for the dialog as it is demonstrated in the following article: https://docs.telerik.com/devtools/winforms/controls/gridview/filtering/custom-filter-dialog 

It is possible to iterate the dialog's Controls collection and set the Font for each contained control explicitly. Since the CompositeDataFilterForm internally uses a RadTreeView, the appropriate way to change the font is by handling the NodeFormatting event: https://docs.telerik.com/devtools/winforms/controls/datafilter/customizing-appearance/formatting-nodes
        private void RadGridView1_CreateCompositeFilterDialog(object sender, GridViewCreateCompositeFilterDialogEventArgs e)
        {
            CompositeDataFilterForm form = e.Dialog as CompositeDataFilterForm;
            if (form!=null)
            {
                form.Font = f;
                ChangeFont(form.Controls);
                
                form.DataFilter.NodeFormatting -= DataFilter_NodeFormatting;
                form.DataFilter.NodeFormatting += DataFilter_NodeFormatting;

                form.DataFilter.EditorInitialized -= DataFilter_EditorInitialized; 
                form.DataFilter.EditorInitialized += DataFilter_EditorInitialized;
            }
        }

        private void ChangeFont(Control.ControlCollection controls)
        {
            foreach (Control c in controls)
            {
                c.Font = f;
                if (c.Controls.Count>0)
                {
                    ChangeFont(c.Controls);
                }
            }
        }

        private void DataFilter_EditorInitialized(object sender, TreeNodeEditorInitializedEventArgs e)
        {
            TreeViewDropDownListEditor dropDownEditor = e.Editor as TreeViewDropDownListEditor;
            if (dropDownEditor!=null)
            {
                BaseDropDownListEditorElement el = dropDownEditor.EditorElement as BaseDropDownListEditorElement;
                el.Font = f;
                el.VisualItemFormatting -= El_VisualItemFormatting; 
                el.VisualItemFormatting += El_VisualItemFormatting;
            }
        }

        private void El_VisualItemFormatting(object sender, VisualItemFormattingEventArgs args)
        {
            args.VisualItem.Font = f;
        }

        private void DataFilter_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
        {
            DataFilterCriteriaElement dataExpressionFilterElement = e.NodeElement as DataFilterCriteriaElement;
            if (dataExpressionFilterElement!=null)
            {
                dataExpressionFilterElement.FieldElement.Font = f;
                dataExpressionFilterElement.OperatorElement.Font = f;
                dataExpressionFilterElement.ValueElement.Font = f;
            }
            e.NodeElement.Font = f;
        }

        Font f = new Font("Arial", 12f, FontStyle.Italic );

In the CreateCompositeFilterDialog event you can also set the CompositeDataFilterForm.RightToLeft property to Yes.

Should you have further questions please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
moj
Top achievements
Rank 1
answered on 01 Mar 2021, 02:27 PM

hi

very thanks

this done

but font item in RadDropDownButton not change

 

0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 02 Mar 2021, 02:59 PM

Hello, Мoj,

Please refer to the following modified code snippet demonstrating how to change the font for the drop down items: 

        private void DataFilter_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
        {
            DataFilterCriteriaElement dataExpressionFilterElement = e.NodeElement as DataFilterCriteriaElement;
            if (dataExpressionFilterElement!=null)
            {
                dataExpressionFilterElement.FieldElement.Font = f;
                dataExpressionFilterElement.OperatorElement.Font = f;
                dataExpressionFilterElement.ValueElement.Font = f;
            }
            DataFilterAddNodeElement addNodeElement = e.NodeElement as DataFilterAddNodeElement;
            if (addNodeElement !=null)
            {
                foreach (RadItem item in addNodeElement.DropDownButton.Items)
                {
                    item.Font = f;
                }
            }
            e.NodeElement.Font = f;
        }

I hope this information helps.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
moj
Top achievements
Rank 1
answered on 02 Mar 2021, 06:08 PM

hi

very thanks

Sorry for the many questions
The font of the following items has not changed either

 

0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 03 Mar 2021, 08:21 AM
Hello, Мoj,
 
The provided screenshots illustrate the Conditional formatting dialog and the context menu for the header cells. You can handle the ContextMenuOpening and the ConditionalFormattingFormShown event and change the font for the menu items and the nested controls in the dialog:
        this.radGridView1.ContextMenuOpening += RadGridView1_ContextMenuOpening;

        private void RadGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
        {
            if (e.ContextMenuProvider is GridHeaderCellElement)
            {
                foreach (RadItem item in e.ContextMenu.Items)
                {
                    item.Font = f;
                }
            }
        }

        this.radGridView1.ConditionalFormattingFormShown += RadGridView1_ConditionalFormattingFormShown; 

        private void RadGridView1_ConditionalFormattingFormShown(object sender, EventArgs e)
        {
            ConditionalFormattingForm form = sender as ConditionalFormattingForm;
            form.Font = f;
            ChangeFont(form.Controls);

        }
        private void ChangeFont(Control.ControlCollection controls)
        {
            foreach (Control c in controls)
            {
                c.Font = f;
                if (c.Controls.Count > 0)
                {
                    ChangeFont(c.Controls);
                }
            }
        }

Note that this is just a sample approach and it may not cover all possible cases. Feel free to modify and extend it in a way which suits your requirements best.

If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
moj
Top achievements
Rank 1
answered on 04 Mar 2021, 03:13 AM

hello

very very thanks

Asked by
moj
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Sr.
Telerik team
moj
Top achievements
Rank 1
Share this question
or