Role based Menus

2 posts, 0 answers
  1. Rana
    Rana avatar
    1 posts
    Member since:
    Sep 2012

    Posted 05 Sep 2012 Link to this post

    I am new to WPF, The scenerio is that i am Developing the application in WPF and i have made the menu.XML file which is a datasource for Ribbon Control. Now i want to hide/Disbale the menu on the basis of user role, User role is defined in Dataabse, Lets if user is Manager then he will only see Requests Tab and similarly if admin has logged in then he might only be able to see requests tab and Admin Tab also.
  2. Tina Stancheva
    Tina Stancheva avatar
    3298 posts

    Posted 10 Sep 2012 Link to this post

    Hello Rana,

    I am not really sure how your data is organized, but it would be best if you can change the ItemsSource of the RadRibbonView based on the current user role. This means that for each user type, there should be a different collection of items to be displayed in the RibbonView.

    If you can't implement this approach in your application, you can try binding the Visibility property of the RadRibbonTabs to a business property - the user role for example. You can define a custom converter to define the Visibility based on your logic:
    <Style TargetType="telerik:RadRibbonTab">
     <Setter Property="Visibility" Value="{Binding UserRole, Converter={StaticResource MyCustomVisibilityConverter}}" />

    Still, in a databinding scenario, it's much better to change the entire ItemsSource collection rather than collapsing certain tabs.

    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft banner
Back to Top