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; }
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; }
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); }