コード例 #1
0
        public static RadMenuItem CreateMenuItem(string text, string imageRelativePath, RichTextBoxCommandBase command, object commandParameter = null)
        {
            RadMenuItem menuItem = new RadMenuItem();
            menuItem.Header = text;

            if (imageRelativePath != null)
            {
                menuItem.Icon = new System.Windows.Controls.Image() { Source = new System.Windows.Media.Imaging.BitmapImage(new Uri(BaseImagePath + imageRelativePath, UriKind.Relative)), Stretch = System.Windows.Media.Stretch.None };
            }

            menuItem.Command = command;

            if (commandParameter != null)
            {
                menuItem.CommandParameter = commandParameter;
            }

            return menuItem;
        }
コード例 #2
0
 private static RadMenuItem CreateMenuItem(string text, string imageRelativePath, RichTextBoxCommandBase command, object commandParameter = null)
 {
     var radMenuItem = new RadMenuItem { Header = text };
     if (imageRelativePath != null)
         radMenuItem.Icon = new Image
                                {
                                    Source =
                                        new BitmapImage(
                                        new Uri(
                                        "/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/" + imageRelativePath,
                                        UriKind.Relative)),
                                    Stretch = Stretch.None
                                };
     radMenuItem.Command = command;
     if (commandParameter != null)
         radMenuItem.CommandParameter = commandParameter;
     return radMenuItem;
 }
コード例 #3
0
        public static RadMenuItem CreateMenuItem(string text, string imageRelativePath, RichTextBoxCommandBase command, object commandParameter = null)
        {
            RadMenuItem menuItem = new RadMenuItem();

            menuItem.Header = text;

            if (imageRelativePath != null)
            {
                menuItem.Icon = new System.Windows.Controls.Image()
                {
                    Source = new BitmapImage(new Uri(BaseImagePath + imageRelativePath, UriKind.Relative)), Stretch = Stretch.None
                };
            }

            menuItem.Command = command;

            if (commandParameter != null)
            {
                menuItem.CommandParameter = commandParameter;
            }

            return(menuItem);
        }