RadMenu icon from code behind?

2 posts, 0 answers
  1. Chinmaya
    Chinmaya avatar
    24 posts
    Member since:
    Aug 2014

    Posted 07 Oct 2014 Link to this post

    below is my code .. but i don't see a property to set Radmenu icon , I am only getting the option for RadmenuItem to set icon.

    example below
    // that i need is insted of FILE i would like to see Icon may be like settings.//

    RadMenu menu = new RadMenu();
                    menu.ClickToOpen = true;
                   
                    menu.Height = 20;                
                    menu.VerticalAlignment = VerticalAlignment.Bottom;
                    menu.HorizontalAlignment = HorizontalAlignment.Stretch;
                    menu.Background = new SolidColorBrush(Colors.LightGray);
                    menu.VerticalAlignment = VerticalAlignment.Top;

                    Image settings = new Image();
                    settings.Source = new BitmapImage(new Uri("/Images/settings.png"));

                    RadMenuItem submenuOptions = new RadMenuItem();
                   // submenuOptions.Header = rm.GetString("Options");
                    submenuOptions.Icon = settings.Source;
                    submenuOptions.IconColumnWidth = 0;
                    submenuOptions.Padding = new System.Windows.Thickness(10, 0, 10, 0);

                    RadMenuItem submenuPointItem = new RadMenuItem();
                    submenuPointItem.Header = rm.GetString("Point_Size");
                    submenuPointItem.IconColumnWidth = 23;
                    submenuPointItem.Padding = new System.Windows.Thickness(10, 0, 10, 0);
                    submenuPointItem.MaxHeight = 20;
                    submenuPointItem.Items.Add(new RadMenuItem() { Header = rm.GetString("Small"), Padding = new System.Windows.Thickness(10, 0, 10, 0), Tag = 1, IsCheckable = true, StaysOpenOnClick = false });

                    submenuPointItem.Items.Add(new RadMenuItem() { Header = rm.GetString("Medium"), Padding = new System.Windows.Thickness(10, 0, 10, 0), Tag = 1, IsCheckable = true, StaysOpenOnClick = false, IsChecked = true });

                    submenuPointItem.Items.Add(new RadMenuItem() { Header = rm.GetString("Big"), Padding = new System.Windows.Thickness(10, 0, 10, 0), Tag = 1, IsCheckable = true, StaysOpenOnClick = false });

                    RadMenuItem submenuValueItem = new RadMenuItem();
                    submenuValueItem.Header = rm.GetString("Values_outside_tolerance");
                    submenuValueItem.IconColumnWidth = 23;
                    submenuValueItem.Padding = new System.Windows.Thickness(10, 0, 10, 0);
                    submenuValueItem.MaxHeight = 20;
                    submenuValueItem.Items.Add(new RadMenuItem() { Header = rm.GetString("Real"), Padding = new System.Windows.Thickness(10, 0, 10, 0), Tag = 2, IsCheckable = true, StaysOpenOnClick = false });

                    submenuValueItem.Items.Add(new RadMenuItem() { Header = rm.GetString("Artificial"), Padding = new System.Windows.Thickness(10, 0, 10, 0), Tag = 2, IsCheckable = true, StaysOpenOnClick = false, IsChecked = true });

                    submenuOptions.Items.Add(submenuPointItem);

                    submenuOptions.Items.Add(submenuValueItem);
                    menu.Items.Add(submenuOptions);
                    menu.ItemClick += radMenu_ItemClick;
                    menuStack.Children.Add(menu);


    any suggestions, how to achieve this  ?
  2. Chinmaya
    Chinmaya avatar
    24 posts
    Member since:
    Aug 2014

    Posted 07 Oct 2014 in reply to Chinmaya Link to this post

    I fond the answer to my question by myself in the similar post.

    here is what i am doing now

    Image settings = new Image();
                    settings.Source = new BitmapImage(new Uri(@"D:/TFS/andon/Andon/Andon/Images/settings.png",UriKind.Absolute));
                    settings.Width = 15;
                    settings.Height = 15;

                    RadMenuItem submenuOptions = new RadMenuItem();
                    //submenuOptions.Header = rm.GetString("Options");
                    submenuOptions.Icon = settings;
                    submenuOptions.IconColumnWidth = 23;
                    submenuOptions.Padding = new System.Windows.Thickness(10, 0, 10, 0);

    thank you
  3. DevCraft banner
Back to Top