Change the font menu in radgridview

11 posts, 0 answers
  1. Ali
    Ali avatar
    9 posts
    Member since:
    Feb 2013

    Posted 27 Feb 2013 Link to this post

    How can I change the font menu on radgridview??
    Attach a photo
  2. Stefan
    Admin
    Stefan avatar
    2911 posts

    Posted 01 Mar 2013 Link to this post

    Hello Ali,

    You can do that in the ContextMenuOpening event:
    void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
    {
        e.ContextMenu.Font = new Font("Arial", 11);
    }

    More information about the context menu in RadGridView is available here: http://www.telerik.com/help/winforms/gridview-context-menus-modifying-the-default-context-menu.html.

    I hope this helps.
     

    Greetings,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Join us for a FREE webinar to see all the new stuff in action.

    Interested, but can’t attend? Register anyway and we’ll send you the recording.
  3. Ali
    Ali avatar
    9 posts
    Member since:
    Feb 2013

    Posted 01 Mar 2013 Link to this post

    Thank you
    Good luck
  4. Ali
    Ali avatar
    9 posts
    Member since:
    Feb 2013

    Posted 02 Mar 2013 Link to this post

    How do I change the font   Excel Like Filtering
  5. Stefan
    Admin
    Stefan avatar
    2911 posts

    Posted 06 Mar 2013 Link to this post

    Hi Ali,

    Thank you for writing back.

    One way to do that is to handle the popup initialization and set the font of the menu items and the popup. In the case of RadListFilterPopup, which contains RadTreeView, you will have to subscribe to its NodeFormatting event in order to change the appearance of the nodes:
    Font f = new Font("Arial", 11);
    void radGridView1_FilterPopupInitialized(object sender, FilterPopupInitializedEventArgs e)
    {
     
        BaseFilterPopup popup = (BaseFilterPopup)e.FilterPopup;
        SetMenuFont(popup.Items);
        popup.Font = f;
     
        if (e.FilterPopup is RadListFilterPopup)
        {
            RadListFilterPopup listFilterPopup = (RadListFilterPopup)e.FilterPopup;
            listFilterPopup.MenuTreeElement.TreeView.NodeFormatting -= TreeView_NodeFormatting;
            listFilterPopup.MenuTreeElement.TreeView.NodeFormatting += TreeView_NodeFormatting;
        }
    }
     
    void TreeView_NodeFormatting(object sender, TreeNodeFormattingEventArgs e)
    {
        e.Node.Font = f;
    }

    Off topic, I would like to kindly ask you to separate the questions that are not related to each other in separate threads, as this will make it easier for the community to find their answers.

    Kind regards,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  6. Ali
    Ali avatar
    9 posts
    Member since:
    Feb 2013

    Posted 07 Mar 2013 Link to this post

    thanks
    I
    am using Telerik 2011 Q3 SP1 version of events does not FilterPopupInitialized
    Can I solve my problem with this version
  7. mohammad
    mohammad avatar
    10 posts
    Member since:
    Mar 2009

    Posted 09 Mar 2013 Link to this post

    I have the same problem.
    version telerik Q3 2011 sp1
  8. Stefan
    Admin
    Stefan avatar
    2911 posts

    Posted 11 Mar 2013 Link to this post

    Hi guys,

    In your version you can use the FilterPopupRequired event to access the filter popup. Here is a sample:
    Font f = new Font("Arial", 11);
    void radGridView1_FilterPopupRequired(object sender, FilterPopupRequiredEventArgs e)
    {
        BaseFilterPopup popup = (BaseFilterPopup)e.FilterPopup;
        SetMenuFont(popup.Items);
        popup.Font = f;
     
        if (e.FilterPopup is RadListFilterPopup)
        {
            RadTreeView tree = (RadTreeView)popup.Controls[1];
            tree.NodeFormatting -= TreeView_NodeFormatting;
            tree.NodeFormatting += TreeView_NodeFormatting;
        }
    }
     
    private void SetMenuFont(Telerik.WinControls.RadItemOwnerCollection radItemOwnerCollection)
    {
        foreach (RadMenuItemBase item in radItemOwnerCollection)
        {
            item.Font = f;
            if (item.HasChildren)
            {
                SetMenuFont(item.Items);
            }
        }
    }

    I hope this helps.

    Greetings,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
  9. mohammad
    mohammad avatar
    10 posts
    Member since:
    Mar 2009

    Posted 12 Mar 2013 Link to this post

    tanks
    But I want to change the font of all parts radgridview
    Do you want to change the font of all parts radgridview
    Example
  10. mohammad
    mohammad avatar
    10 posts
    Member since:
    Mar 2009

    Posted 14 Mar 2013 Link to this post

    But I want to change the font of all parts radgridview
    Do you want to change the font of all parts radgridview
  11. Stefan
    Admin
    Stefan avatar
    2911 posts

    Posted 14 Mar 2013 Link to this post

    Hello Mohammad,

    I would suggest that you open a new thread and address your questions there, so we do not mix the subjects. This thread is named "Change the font menu in radgridview", so lets keep it for the font of the menus. 

    Additionally, you can check out how to use the forums here: http://www.telerik.com/community/forums/winforms/gridview/important-information-on-using-the-telerik-forums.aspx.

    Greetings,
    Stefan
    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top