How to dynamically give vertical scroll bar inside RadMenuItem. Below is my code.
RadMenuItem subMenu = new RadMenuItem();
foreach (GridViewColumn column in grid.Columns)
{
subMenu = new RadMenuItem();
subMenu.Header = column.Header;
subMenu.IsCheckable = true;
subMenu.IsChecked = true;
Binding isCheckedBinding = new Binding("IsVisible");
isCheckedBinding.Mode = BindingMode.TwoWay;
isCheckedBinding.Source = column;
subMenu.SetBinding(RadMenuItem.IsCheckedProperty, isCheckedBinding);
item.Items.Add(subMenu);
}
System.Windows.Controls.ScrollViewer.SetVerticalScrollBarVisibility(subMenu, System.Windows.Controls.ScrollBarVisibility.Visible);
RadMenuItem subMenu = new RadMenuItem();
foreach (GridViewColumn column in grid.Columns)
{
subMenu = new RadMenuItem();
subMenu.Header = column.Header;
subMenu.IsCheckable = true;
subMenu.IsChecked = true;
Binding isCheckedBinding = new Binding("IsVisible");
isCheckedBinding.Mode = BindingMode.TwoWay;
isCheckedBinding.Source = column;
subMenu.SetBinding(RadMenuItem.IsCheckedProperty, isCheckedBinding);
item.Items.Add(subMenu);
}
System.Windows.Controls.ScrollViewer.SetVerticalScrollBarVisibility(subMenu, System.Windows.Controls.ScrollBarVisibility.Visible);
5 Answers, 1 is accepted
0
Accepted
Hi Sravanthi,
I'm not sure I fully understand your idea. If you want to have VerticalScrollBar for your RadMenuItem, you should put it inside the header. RadMenuItem's header is of type object so you can put whatever you need.
If you want to have scrollbar for the submenu items (for example if you have a lot of items and you want to scroll through all of them), you can check this article for more information how to achieve it.
Hopefully this helps.
All the best,
Rosen Vladimirov
the Telerik team
I'm not sure I fully understand your idea. If you want to have VerticalScrollBar for your RadMenuItem, you should put it inside the header. RadMenuItem's header is of type object so you can put whatever you need.
If you want to have scrollbar for the submenu items (for example if you have a lot of items and you want to scroll through all of them), you can check this article for more information how to achieve it.
Hopefully this helps.
All the best,
Rosen Vladimirov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Sravanthi
Top achievements
Rank 1
answered on 10 May 2013, 09:03 AM
Please help me to fix the issue. I have a RadGridView with 40 Columns and when I right click on Header of any column it will show Choose Columns,Sorting Asc, Sorting Desc in Menu and when I select Choose Columns it is showing all the columns in sub menu. But I am unable to scroll down. It is showing 28 columns in the page remaining 12 Columns are down the screen. here iam unable to see remaining 12 Columns and unable to scroll down.
Please help me. I am struck with this issue since 2 days.
Please help me. I am struck with this issue since 2 days.
0
Hi Sravanthi,
I'm sending you a project demonstrating how to achieve this. The project is created based on this article. Please note that with our next official release we'll have integrated scrolling functionality inside RadContextMenu, so there will be no need to modify the templates.
Please check the attachment and inform us if you have any problems or concerns.
Greetings,
Rosen Vladimirov
the Telerik team
I'm sending you a project demonstrating how to achieve this. The project is created based on this article. Please note that with our next official release we'll have integrated scrolling functionality inside RadContextMenu, so there will be no need to modify the templates.
Please check the attachment and inform us if you have any problems or concerns.
Greetings,
Rosen Vladimirov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
0
Sravanthi
Top achievements
Rank 1
answered on 15 May 2013, 09:24 AM
Thank you for the reply Rosan. I saw the code which you sent. I need to same created context menu and Submenu dynamically from code behind and give vertical scroll bar to submenu items.
Please help me to solve this issue
Thanks,
Sravanthi
Please help me to solve this issue
Thanks,
Sravanthi
0
Sravanthi
Top achievements
Rank 1
answered on 15 May 2013, 11:17 AM
Thank you so much Rosan. Finally I fixed the issue by dynamically creating menu and submenu..