menu item dropdownheight dynamic

2 posts, 0 answers
  1. Piyush
    Piyush avatar
    1 posts
    Member since:
    Sep 2014

    Posted 01 Apr 2015 Link to this post

    i want to have a scroll to be added in the submenu item list.
    if im making radmenuItem.DropDownHeight = 200, then i can achieve wat want. 
    but issue arise when the submenu item are less(say2), then submenuitem list shows 2 submenu item and rest space is show blank, ie. it takes minumun height to the submenu item list as 200.

    FUNCTION: 
      private void AddtoReporMenuItem_OnMouseEnter(object sender, MouseEventArgs e)
            {
                var treeViewModel = this.DataContext as TreeViewModel;
                if(radcontextMenu.Items.Count>2)
                    radcontextMenu.Items.RemoveAt(2);
                RadMenuItem  reportItem = new RadMenuItem(){Header = "Add to Report"};
                RadMenuItem reportNamesItem;
                RadMenuGroupItem reportsList = new RadMenuGroupItem();
                if (treeViewModel.Reports != null)
                {
                    foreach (var report in treeViewModel.Reports)
                    {
                        reportNamesItem = new RadMenuItem();
                        reportNamesItem.Header = report.ReportName;
                        reportNamesItem.Click += (senderObj, eventargs) => reportItem_Click(senderObj, eventargs, report);
                        reportsList.Items.Add(reportNamesItem);
                    }
                   
                    reportItem.Items.Add(reportsList);
                    reportItem.DropDownHeight = 200;
                    radcontextMenu.Items.Add(reportItem);
                }

            }




    xaml:
       <telerik:RadContextMenu.ContextMenu>
                    <telerik:RadContextMenu x:Name="radcontextMenu" MouseEnter="AddtoReporMenuItem_OnMouseEnter">
                        <telerik:RadMenuItem Header="{localization:Translate DeleteTxt}" Command="{Binding Path=DeleteChartDash}" />
                        <telerik:RadMenuItem Header="{localization:Translate ExportButton}">
                            <telerik:RadMenuItem Header="CSV" Command="{Binding Path=ExportCommand}" CommandParameter="ExportChart" />
                            <telerik:RadMenuItem Header="{localization:Translate ExportdataTxt}" Command="{Binding Path=ExportCommand}" CommandParameter="ExportData"  />
                            <telerik:RadMenuItem Header="{localization:Translate PowerPointTxt}" Command="{Binding Path=ExportCommand}" CommandParameter="ExportPPT"  />
                            </telerik:RadMenuItem>
                    </telerik:RadContextMenu>
                </telerik:RadContextMenu.ContextMenu>




  2. Kalin
    Admin
    Kalin avatar
    1209 posts

    Posted 02 Apr 2015 Link to this post

    Hello Piyush,

    Please check my reply in the following thread, it should help you to achieve the desired:
    http://www.telerik.com/forums/maximum-dropdownheight

    Hope this helps.

    Regards,
    Kalin
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top