To create menu dynamically along with icons

3 posts, 0 answers
  1. Anupam
    Anupam avatar
    6 posts
    Member since:
    Jul 2011

    Posted 27 Jul 2011 Link to this post

    I am able to create the menu dynamically for radmenu from data base,but i am unable to populate the icons for the same .
    Kindly Suggest the solution for the same..
    I have tried MenuItem.Icon property but its not either helping me out.

    The code for populating menu are:
    IN XAML:
    <telerik:RadMenu  x:Name="GEMSMenu" Style="{StaticResource Mainmenus}" FontWeight="Bold"  Cursor="Hand" Margin="30,0"  Background="{x:Null}" Foreground="White" Grid.Row="1"  VerticalAlignment="Bottom" FontSize="12" FontFamily="Arial"  BorderBrush="{x:Null}"  >
       </telerik:RadMenu>
    IN XAML.CS

      private void LoadMenu(GetMenuProviderDetailCompletedEventArgs MenuProvider)
            {
                var parentList = (from Parmenu in MenuProvider.Result where Parmenu.ParentId.Equals(string.Empty)  select Parmenu).Distinct();

                foreach (var parent in  parentList)
                {
                     RadMenuItem MenuItem = new RadMenuItem();
                     MenuItem.Header = parent.MenuName;
                    GEMSMenu.Items.Add(MenuItem);
                    var ChildList = (from childmenu in MenuProvider.Result where childmenu.ParentId.Equals(parent.MenuId)  select childmenu).Distinct();

                    foreach (var child in ChildList)
                    {
                        RadMenuItem ChildItem = new RadMenuItem();
                       
                        ChildItem.Header = child.MenuName;
                        MenuItem.Items.Add(ChildItem);
                        var SubChildList = (from Subchildmenu in MenuProvider.Result where Subchildmenu.ParentId.Equals(child.MenuId)   select Subchildmenu).Distinct();

                        foreach (var Subchild in SubChildList)
                        {
                            RadMenuItem SubChildItem = new RadMenuItem();
                            SubChildItem.Header = Subchild.MenuName;
                            ChildItem.Items.Add(SubChildItem);

                        }

                    }
                }
            }

     
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 29 Jul 2011 Link to this post

    Hello Anupam,

    I cannot see how do you set the Icon property, but here is a help article that should be useful:
    http://www.telerik.com/help/silverlight/radmenu-features-icons.html

    Kind regards,
    Valeri Hristov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. DevCraft banner
  4. Anupam
    Anupam avatar
    6 posts
    Member since:
    Jul 2011

    Posted 29 Jul 2011 Link to this post

    Actually I have to create menus dynamically along with menu icons using MVVM pattern....Is it possible to do so?
Back to Top