This is a migrated thread and some comments may be shown as answers.

Date Picker in Filter Context Menu

1 Answer 297 Views
VirtualGrid
This is a migrated thread and some comments may be shown as answers.
Marianne
Top achievements
Rank 1
Veteran
Marianne asked on 13 May 2020, 12:08 PM
Is it possible to replace the context menu with a date picker control?  I don't want to post my code because if I have been able to show the date picker it has been sharply compressed.  Do I remove the items - or just hide them?  Where do I add the date picker control?  And how do I make it bigger - it automatically appears as 200, 20 and I need it to be 300, 300 at least

1 Answer, 1 is accepted

Sort by
0
Nadya | Tech Support Engineer
Telerik team
answered on 15 May 2020, 10:28 AM

Hello Marianne,

If you want to show a RadDateTimePicker in the context menu in the virtual grid when you right-click with the mouse on the filtering row I can suggest you to create a custom context menu. The ContextMenuOpening event is the right place to assign the new context menu to your grid. You can use the RadHostItem class which allows adding controls in elements. Please refer to the following articles:
https://docs.telerik.com/devtools/winforms/controls/virtualgrid/context-menu/custom-context-menu
https://docs.telerik.com/devtools/winforms/telerik-presentation-framework/elements/use-control-inside-an-element

Please refer to the following example:

public partial class RadForm1 : Telerik.WinControls.UI.RadForm
    {

        RadContextMenu contextMenu = new RadContextMenu();
        public RadForm1()
        {
            InitializeComponent();
            RadDateTimePicker picker = new RadDateTimePicker();
            RadMenuItem menuItem1 = new RadMenuItem();
            menuItem1.MinSize = new Size(200, 30);
            RadHostItem hostItem = new RadHostItem(picker);
            menuItem1.Children.Add(hostItem);
            contextMenu.Items.Add(menuItem1);

            this.radVirtualGrid1.ContextMenuOpening += this.RadVirtualGrid1_ContextMenuOpening;
            
        }

        private void RadVirtualGrid1_ContextMenuOpening(object sender, VirtualGridContextMenuOpeningEventArgs e)
        {
            if (e.RowIndex == -3)
            {
                e.ContextMenu = contextMenu.DropDown;
            }
        }
}

I hope this helps. If you have other questions do not hesitate to ask.

Regards,
Nadya
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
VirtualGrid
Asked by
Marianne
Top achievements
Rank 1
Veteran
Answers by
Nadya | Tech Support Engineer
Telerik team
Share this question
or