I am upgrading a Telerik Silverlight app to use roles for the menu -- i.e. only allow people in certain ASP.NET membership roles to see or execute certain menu items. In non-SL code, I would use a sitemap, but that does not seem to be an option here. How do I enforce roles with a RadMenu?
With Silverlight you can collapse certain items in the RadMenu if conditions are not met. For instance:
if(IsUserAdmin) // this checks for "true", you could reverse it by using !IsUserAdmin
this.ImportantRadMenuButton1.Visibiity = Visibility.Visible;
this.ImportantRadMenuButton2.Visibiity = Visibility.Visible;
this.ImportantRadMenuButton1.Visibiity = Visibility.Collapsed;
this.ImportantRadMenuButton2.Visibiity = Visibility.Collapsed;
You would apply this method example in a page loaded event or a user role changed event, where ImportantRadMenuButton is a menu item that you only want Admin roles to see. IsUserAdmin in this example is a bool that is associate with a role, but depending on the way your app has it's roles stored you just check for a true/false condition and then collapse/show menu items accordingly.
This link will bring you to the documentation for the IsEnabled property of the control items, the main difference between this and collpased is the user will be able to see the menu items even though they can't click them.