5 Answers, 1 is accepted
0
Hi runes,
Here is a simple example demonstrating one possible solution to add menu items dynamically on MeunItem Click event.
This is the page.xaml:
and this is the code-behind:
Note that you will need references toTelerik.Windows.Controls and Telerik.Windows.Controls.Navigation assemblies.
Let us know if you need more help.
Sincerely yours,
Hristo
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Here is a simple example demonstrating one possible solution to add menu items dynamically on MeunItem Click event.
This is the page.xaml:
<UserControl x:Class="SilverlightApplication30.Page" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:core="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" |
xmlns:nav="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.navigation" |
xmlns:local="clr-namespace:SilverlightApplication30;assembly=SilverlightApplication30"> |
<Grid> |
<Button Content="Click Me" VerticalAlignment="Center"> |
<nav:RadContextMenu.ContextMenu> |
<nav:RadContextMenu EventName="Click" x:Name="radContextMenu1"> |
<nav:RadMenuItem Header="Click me to add more items" /> |
</nav:RadContextMenu> |
</nav:RadContextMenu.ContextMenu> |
</Button> |
</Grid> |
</UserControl> |
and this is the code-behind:
using System.Windows; |
using System.Windows.Controls; |
using Telerik.Windows; |
using Telerik.Windows.Controls; |
namespace SilverlightApplication30 |
{ |
public partial class Page : UserControl |
{ |
public Page() |
{ |
InitializeComponent(); |
radContextMenu1.AddHandler(RadMenuItem.ClickEvent, new RoutedEventHandler(OnMenuItemClick)); |
} |
private void OnMenuItemClick(object sender, RoutedEventArgs e) |
{ |
RadRoutedEventArgs args = e as RadRoutedEventArgs; |
RadMenuItem item = args.OriginalSource as RadMenuItem; |
RadMenuItem item1 = new RadMenuItem() { Header = "Dynamic 1" }; |
RadMenuItem item2 = new RadMenuItem() { Header = "Dynamic 2" }; |
item.Items.Add(item1); |
item.Items.Add(item2); |
} |
} |
} |
Note that you will need references toTelerik.Windows.Controls and Telerik.Windows.Controls.Navigation assemblies.
Let us know if you need more help.
Sincerely yours,
Hristo
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Sai Krishna
Top achievements
Rank 1
answered on 26 Nov 2009, 09:32 AM
Hi,
I am trying to generate context menu item (Parent as well as child menu items) for a RadGrid from server side(C#). but i have no luck.
please provide me solution for this
sai
I am trying to generate context menu item (Parent as well as child menu items) for a RadGrid from server side(C#). but i have no luck.
please provide me solution for this
sai
0
Hi,
I'm afraid that you cannot create Silverlight components server-side. You can check however this demo to know more how to generate context menus dynamically on the Silverlight client.
Greetings,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I'm afraid that you cannot create Silverlight components server-side. You can check however this demo to know more how to generate context menus dynamically on the Silverlight client.
Greetings,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Sai Krishna
Top achievements
Rank 1
answered on 26 Nov 2009, 10:44 AM
thanks for the response,
I am not using any silverlight component. it is just normal telerik:RadContextMenu on telerik:RadGrid. for ASP.net web application.
I am not using any silverlight component. it is just normal telerik:RadContextMenu on telerik:RadGrid. for ASP.net web application.
0
Hello,
This forum is for our Silverlight components - you can post your questions in the relevant forum!
Sincerely yours,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
This forum is for our Silverlight components - you can post your questions in the relevant forum!
Sincerely yours,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.