Binding radRichTextBox with RaRibbonBar - Help

2 posts, 1 answers
  1. John
    John avatar
    34 posts
    Member since:
    Oct 2010

    Posted 20 Oct 2010 Link to this post

    Greetings,

    I am fascinated with the telerik SL package, specially in radRichTextBox.  However, I have little problem catching up with the way it is programming...

    Here is my problem.  I create one RadRichTextBox and one radRibbonBar to work as a MSword-like textbox.  Upon completion of designing it, when I enter any text in the RadRichTextBox, any button click in Ribbon doesn't seem to work in RadRichTextBox  as expected.  For example, I highlight one sentence in RadRichTextBox, click on the Bold button, the sentence should be bolded as expected.  It doesn't. 

    Not sure I am missing something....
    Below is my code:

    MainPage.xaml

    <telerik:RadRibbonBar DataContext="{Binding Path=Commands, ElementName=rtb}" x:Name="radRibbonBar1" ApplicationName="Testing Notes"
                          ApplicationButtonImageSource="images/telerik/RibbonBar/IconMSOffice/AppIcon.png"
                          telerikQuickStart:ThemeAwareBackgroundBehavior.IsEnabled="True"
                          telerik:KeyTipService.IsKeyTipsEnabled="True" MinimizeButtonVisibility="Visible">
        <telerik:RadRibbonTab Header="Home" telerik:KeyTipService.AccessText="H">
            <telerik:RadRibbonGroup Header="Clipboard" telerik:ScreenTip.Title="Clipboard"
                    telerik:ScreenTip.Description="Show the Clipboard Task options."
                    telerik:ScreenTip.Icon="images/telerik/RibbonBar/IconMSOffice/ClipboardScreenTipIcon.png"
                    DialogLauncherVisibility="Visible" LaunchDialog="RibbonGroup_LaunchDialog"
                    Icon="images/telerik/RibbonBar/IconMSOffice/16/paste.png" telerik:KeyTipService.AccessText="FO">
                <telerik:RadRibbonGroup.Variants>
                    <telerik:GroupVariant Variant="Medium" Priority="0" />
                </telerik:RadRibbonGroup.Variants>
                <telerik:RadRibbonSplitButton Text="Paste"
                        SmallImage="images/telerik/RibbonBar/IconMSOffice/16/paste.png"
                        LargeImage="images/telerik/RibbonBar/IconMSOffice/32/paste.png" Size="Large"
                        telerik:ScreenTip.Title="Paste"
                        telerik:ScreenTip.Description="Paste the contents of the Clipboard."
                        telerik:KeyTipService.AccessText="V">
                    <telerik:RadRibbonSplitButton.DropDownContent>
                        <telerik:RadContextMenu BorderThickness="0">
                            <telerik:RadMenuItem Header="Paste" telerik:KeyTipService.AccessText="S">
                                <telerik:RadMenuItem.Icon>
                                    <Image Stretch="None" Source="images/telerik/RibbonBar/IconMSOffice/16/paste.png" />
                                </telerik:RadMenuItem.Icon>
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem Header="Paste Special..." telerik:KeyTipService.AccessText="H">
                                <telerik:RadMenuItem.Icon>
                                    <Image Stretch="None"
                                            Source="images/telerik/RibbonBar/IconMSOffice/16/pastespecial.png" />
                                </telerik:RadMenuItem.Icon>
                            </telerik:RadMenuItem>
                            <telerik:RadMenuItem Header="Paste as Hyperlink" IsEnabled="False">
                                <telerik:RadMenuItem.Icon>
                                    <Image Stretch="None"
                                            Source="images/telerik/RibbonBar/IconMSOffice/16/pastehyperlink.png" />
                                </telerik:RadMenuItem.Icon>
                            </telerik:RadMenuItem>
                        </telerik:RadContextMenu>
                    </telerik:RadRibbonSplitButton.DropDownContent>
                </telerik:RadRibbonSplitButton>
                <StackPanel>
                    <telerik:RadRibbonButton Text="Cut" SmallImage="images/telerik/RibbonBar/IconMSOffice/16/cut.png"
                            CollapseToSmall="WhenGroupIsMedium" telerik:ScreenTip.Title="Cut"
                            telerik:ScreenTip.Description="Cut the selection from the document and put it on the Clipboard."
                            telerik:KeyTipService.AccessText="X" />
                    <telerik:RadRibbonButton Text="Copy" SmallImage="images/telerik/RibbonBar/IconMSOffice/16/copy.png"
                            CollapseToSmall="WhenGroupIsMedium" telerik:ScreenTip.Title="Copy"
                            telerik:ScreenTip.Description="Copy the selection and put it on the Clipboard."
                            telerik:KeyTipService.AccessText="C" />
                    <telerik:RadRibbonButton Text="Format Painter"
                            SmallImage="images/telerik/RibbonBar/IconMSOffice/16/formatpainter.png"
                            CollapseToSmall="WhenGroupIsMedium" telerik:ScreenTip.Title="Format Painter"
                            telerik:ScreenTip.Description="Copy formatting from one place and apply it to another. Double-click this button to apply the same formatting to multiple places in the document."
                            telerik:KeyTipService.AccessText="FP" />
                </StackPanel>
            </telerik:RadRibbonGroup>
            <telerik:RadRibbonGroup Header="Font" telerik:ScreenTip.Title="Font"
                    telerik:ScreenTip.Description="Show the Font dialog box."
                    telerik:ScreenTip.Icon="images/telerik/RibbonBar/IconMSOffice/FontScreenTipIcon.png"
                    DialogLauncherVisibility="Visible" LaunchDialog="RibbonGroup_LaunchDialog"
                    telerik:KeyTipService.AccessText="FN" telerik:KeyTipService.AltAccessText="ZF">
                <telerik:RadRibbonGroup.Variants>
                    <telerik:GroupVariant Variant="Medium" Priority="3" />
                    <telerik:GroupVariant Variant="Small" Priority="7" />
                    <telerik:GroupVariant Variant="Collapsed" Priority="8" />
                </telerik:RadRibbonGroup.Variants>
                <telerik:RadOrderedWrapPanel CompressedItemsOrder="0,3,2,4,1">
                    <StackPanel Orientation="Horizontal">
                        <telerik:RadRibbonComboBox Width="135" SelectedIndex="1" telerik:ScreenTip.Title="Font"
                                telerik:ScreenTip.Description="Change the font face."
                                telerik:KeyTipService.AccessText="FF">
                            <telerik:RadRibbonComboBoxItem Content="Arial" />
                            <telerik:RadRibbonComboBoxItem Content="Calibri (Body)" />
                            <telerik:RadRibbonComboBoxItem Content="Tahoma" />
                            <telerik:RadRibbonComboBoxItem Content="Verdana" />
                            <telerik:RadRibbonComboBoxItem Content="Times New Roman" />
                            <telerik:RadRibbonComboBoxItem Content="Cambria" />
                        </telerik:RadRibbonComboBox>
                        <telerik:RadRibbonComboBox Name="comboFontSize" Width="45" SelectedIndex="0"
                                telerik:ScreenTip.Title="Font Size"
                                telerik:ScreenTip.Description="Change the font size."
                                telerik:KeyTipService.AccessText="FS">
                            <telerik:RadRibbonComboBoxItem Content="8" />
                            <telerik:RadRibbonComboBoxItem Content="9" />
                            <telerik:RadRibbonComboBoxItem Content="10" />
                            <telerik:RadRibbonComboBoxItem Content="11" />
                            <telerik:RadRibbonComboBoxItem Content="12" />
                            <telerik:RadRibbonComboBoxItem Content="14" />
                            <telerik:RadRibbonComboBoxItem Content="16" />
                            <telerik:RadRibbonComboBoxItem Content="18" />
                        </telerik:RadRibbonComboBox>
                    </StackPanel>
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/font-increasesize.png"
                                telerik:ScreenTip.Title="Grow Font" telerik:KeyTipService.AccessText="FG" />
                        <telerik:RadRibbonButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/font-decreasesize.png"
                                telerik:ScreenTip.Title="Shrink Font" telerik:KeyTipService.AccessText="FH" />
                    </telerik:RadButtonGroup>
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/ClearFormatting16.png"
                                Text="Clear Formatting" telerik:ScreenTip.Title="Clear Formatting"
                                telerik:KeyTipService.AccessText="E" />
                    </telerik:RadButtonGroup>
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonToggleButton x:Name="BoldButton"
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/bold.png"
                                telerik:ScreenTip.Title="Bold"
                                telerik:ScreenTip.Description="Make the selected text bold."
                                telerik:KeyTipService.AccessText="1" />
                        <telerik:RadRibbonToggleButton x:Name="ItalicButton"
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/italic.png"
                                telerik:ScreenTip.Title="Italic"
                                telerik:ScreenTip.Description="Italicize the selected text."
                                telerik:KeyTipService.AccessText="2" />
                        <telerik:RadRibbonSplitButton x:Name="UnderlineButton"
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/underline.png"
                                telerik:ScreenTip.Title="Underline"
                                telerik:ScreenTip.Description="Underline the selected text."
                                telerik:KeyTipService.AccessText="3">
                            <telerik:RadRibbonSplitButton.DropDownContent>
                                <StackPanel>
                                    <telerik:RadGallery ViewportWidth="157" ViewportHeight="184" ItemWidth="156"
                                            ItemHeight="26">
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/underline1.png"
                                                ToolTipService.ToolTip="Underline" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/underline2.png"
                                                ToolTipService.ToolTip="Double underline" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/underline3.png"
                                                ToolTipService.ToolTip="Thick underline" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/underline4.png"
                                                ToolTipService.ToolTip="Dotted underline" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/underline5.png"
                                                ToolTipService.ToolTip="Dashed underline" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/underline6.png"
                                                ToolTipService.ToolTip="Dot-dash underline" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/underline7.png"
                                                ToolTipService.ToolTip="Dot-dot-dash underline" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/underline8.png"
                                                ToolTipService.ToolTip="Wave underline" />
                                    </telerik:RadGallery>
                                    <telerik:RadContextMenu BorderThickness="0">
                                        <telerik:RadMenuItem Header="More underlines ..."
                                                telerik:KeyTipService.AccessText="M" />
                                        <telerik:RadMenuItem Header="Underline color"
                                                telerik:KeyTipService.AccessText="U">
                                            <telerik:RadMenuItem.Icon>
                                                <Image Stretch="None"
                                                        Source="images/telerik/RibbonBar/IconMSOffice/colorpicker.png" />
                                            </telerik:RadMenuItem.Icon>
                                        </telerik:RadMenuItem>
                                    </telerik:RadContextMenu>
                                </StackPanel>
                            </telerik:RadRibbonSplitButton.DropDownContent>
                        </telerik:RadRibbonSplitButton>
                        <telerik:RadRibbonToggleButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/Strikethrough16.png"
                                telerik:ScreenTip.Title="Strikethrough"
                                telerik:ScreenTip.Description="Draw a line through the middle of the selected text."
                                telerik:KeyTipService.AccessText="4" />
                        <telerik:RadRibbonToggleButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/subscript.png"
                                telerik:ScreenTip.Title="Subscript"
                                telerik:ScreenTip.Description="Create small letters below the text baseline."
                                telerik:KeyTipService.AccessText="5" />
                        <telerik:RadRibbonToggleButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/superscript.png"
                                telerik:ScreenTip.Title="Superscript"
                                telerik:ScreenTip.Description="Create small letters above the line of text."
                                telerik:KeyTipService.AccessText="6" />
                        <telerik:RadRibbonDropDownButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/fontscheme.png" Text="Change Case"
                                telerik:ScreenTip.Title="Change Case"
                                telerik:ScreenTip.Description="Change all the selected text to UPPERCASE, lowercase, or other common capitalizations."
                                telerik:KeyTipService.AccessText="7">
                            <telerik:RadRibbonDropDownButton.DropDownContent>
                                <telerik:RadContextMenu BorderThickness="0">
                                    <telerik:RadMenuItem Header="Sentence case."
                                            telerik:KeyTipService.AccessText="S" />
                                    <telerik:RadMenuItem Header="lowercase" telerik:KeyTipService.AccessText="L" />
                                    <telerik:RadMenuItem Header="UPPERCASE" telerik:KeyTipService.AccessText="U" />
                                    <telerik:RadMenuItem Header="Capitalize Each Word"
                                            telerik:KeyTipService.AccessText="C" />
                                    <telerik:RadMenuItem Header="tOGGLE cASE" telerik:KeyTipService.AccessText="T" />
                                </telerik:RadContextMenu>
                            </telerik:RadRibbonDropDownButton.DropDownContent>
                        </telerik:RadRibbonDropDownButton>
                    </telerik:RadButtonGroup>
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonButton SmallImage="images/telerik/RibbonBar/IconMSOffice/16/highlight.png"
                                Text="Highlight Color" telerik:ScreenTip.Title="Text Highlight Color"
                                telerik:ScreenTip.Description="Make text look like it was marked with a highlighter pen."
                                telerik:KeyTipService.AccessText="I">
                        </telerik:RadRibbonButton>
                        <telerik:RadRibbonDropDownButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/fontcolor.png" Text="Font Color"
                                telerik:ScreenTip.Title="Font Color"
                                telerik:ScreenTip.Description="Change the text color."
                                telerik:KeyTipService.AccessText="FC">
                            <telerik:RadRibbonDropDownButton.DropDownContent>
                                <telerik:RadColorSelector />
                            </telerik:RadRibbonDropDownButton.DropDownContent>
                        </telerik:RadRibbonDropDownButton>
                    </telerik:RadButtonGroup>
                </telerik:RadOrderedWrapPanel>
            </telerik:RadRibbonGroup>
            <telerik:RadRibbonGroup Header="Paragraph" telerik:ScreenTip.Title="Paragraph"
                    telerik:ScreenTip.Description="Show the Paragraph dialog box."
                    telerik:ScreenTip.Icon="images/telerik/RibbonBar/IconMSOffice/ParagraphScreenTipIcon.png"
                    DialogLauncherVisibility="Visible" LaunchDialog="RibbonGroup_LaunchDialog"
                    telerik:KeyTipService.AccessText="PG" telerik:KeyTipService.AltAccessText="ZP">
                <telerik:RadRibbonGroup.Variants>
                    <telerik:GroupVariant Variant="Medium" Priority="2" />
                    <telerik:GroupVariant Variant="Collapsed" Priority="6" />
                </telerik:RadRibbonGroup.Variants>
                <telerik:RadOrderedWrapPanel CompressedItemsOrder="0,1,4,5,6,2,3">
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonDropDownButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/list-bullets.png"
                                telerik:ScreenTip.Title="Bullets"
                                telerik:ScreenTip.Description="Start a bulleted list. Click the arrow to choose different bullet styles."
                                telerik:KeyTipService.AccessText="U">
                            <telerik:RadRibbonDropDownButton.DropDownContent>
                                <StackPanel>
                                    <telerik:RadGroupHeader Content="Bullet Library" />
                                    <telerik:RadGallery ItemHeight="48" ItemWidth="48" ViewportHeight="98"
                                            ViewportWidth="288">
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryBulletsNone.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryBulletsType1.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryBulletsType2.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryBulletsType3.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryBulletsType4.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryBulletsType5.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryBulletsType6.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryBulletsType7.png" />
                                    </telerik:RadGallery>
                                    <telerik:RadContextMenu BorderThickness="0">
                                        <telerik:RadMenuItem Header="Change List Level"
                                                telerik:KeyTipService.AccessText="C" />
                                        <telerik:RadMenuItem Header="Define New Bullet ..."
                                                telerik:KeyTipService.AccessText="D" />
                                    </telerik:RadContextMenu>
                                </StackPanel>
                            </telerik:RadRibbonDropDownButton.DropDownContent>
                        </telerik:RadRibbonDropDownButton>
                        <telerik:RadRibbonDropDownButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/list-numbered.png"
                                telerik:ScreenTip.Title="Numbers"
                                telerik:ScreenTip.Description="Start a numbered list. Click the arrow to choose different numbering formats."
                                telerik:KeyTipService.AccessText="N">
                            <telerik:RadRibbonDropDownButton.DropDownContent>
                                <StackPanel>
                                    <telerik:RadGroupHeader Content="Recently Used Number Formats" />
                                    <telerik:RadGallery ItemHeight="80" ItemWidth="80" ViewportHeight="80"
                                            ViewportWidth="80">
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryNumbersType1.png" />
                                    </telerik:RadGallery>
                                    <telerik:RadGroupHeader Content="Numbering Library" />
                                    <telerik:RadGallery ItemHeight="80" ItemWidth="80" ViewportHeight="240"
                                            ViewportWidth="240">
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryNumbersNone.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryNumbersType1.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryNumbersType2.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryNumbersType3.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryNumbersType4.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryNumbersType5.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryNumbersType6.png" />
                                        <telerik:RadGalleryItem
                                                Image="images/telerik/RibbonBar/IconMSOffice/GalleryNumbersType7.png" />
                                    </telerik:RadGallery>
                                    <telerik:RadContextMenu BorderThickness="0">
                                        <telerik:RadMenuItem Header="Change List Level"
                                                telerik:KeyTipService.AccessText="C" />
                                        <telerik:RadMenuItem Header="Define New Number Format ..."
                                                telerik:KeyTipService.AccessText="D" />
                                        <telerik:RadMenuItem Header="Set Numbering Value ..."
                                                telerik:KeyTipService.AccessText="V" />
                                    </telerik:RadContextMenu>
                                </StackPanel>
                            </telerik:RadRibbonDropDownButton.DropDownContent>
                        </telerik:RadRibbonDropDownButton>
                        <telerik:RadRibbonButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/list-numbered-tb.png"
                                Text="Multilevel List" telerik:KeyTipService.AccessText="M">
     
                        </telerik:RadRibbonButton>
                    </telerik:RadButtonGroup>
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonButton SmallImage="images/telerik/RibbonBar/IconMSOffice/16/outdent.png"
                                telerik:KeyTipService.AccessText="AO" />
                        <telerik:RadRibbonButton SmallImage="images/telerik/RibbonBar/IconMSOffice/16/indent.png"
                                telerik:KeyTipService.AccessText="AI" />
                    </telerik:RadButtonGroup>
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonButton SmallImage="images/telerik/RibbonBar/IconMSOffice/16/sortasc.png"
                                Text="Sort" telerik:KeyTipService.AccessText="SO"/>
                    </telerik:RadButtonGroup>
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonButton SmallImage="images/telerik/RibbonBar/IconMSOffice/16/zoom.png"
                                Text="Zoom" telerik:KeyTipService.AccessText="ZO" />
                    </telerik:RadButtonGroup>
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonRadioButton IsChecked="True"
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/alignleft.png"
                                telerik:KeyTipService.AccessText="AL" />
                        <telerik:RadRibbonRadioButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/aligncenter.png"
                                telerik:KeyTipService.AccessText="AC" />
                        <telerik:RadRibbonRadioButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/alignright.png"
                                telerik:KeyTipService.AccessText="AR" />
                        <telerik:RadRibbonRadioButton
                                SmallImage="images/telerik/RibbonBar/IconMSOffice/16/alignjustify.png"
                                telerik:KeyTipService.AccessText="AJ" />
                    </telerik:RadButtonGroup>
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonButton SmallImage="images/telerik/RibbonBar/IconMSOffice/16/expandspace.png"
                                Text="Line Spacing" telerik:KeyTipService.AccessText="8">
     
                        </telerik:RadRibbonButton>
                    </telerik:RadButtonGroup>
                    <telerik:RadButtonGroup>
                        <telerik:RadRibbonButton SmallImage="images/telerik/RibbonBar/IconMSOffice/16/linecolor.png"
                                Text="Shading" telerik:KeyTipService.AccessText="H">
     
                        </telerik:RadRibbonButton>
                        <telerik:RadRibbonButton SmallImage="images/telerik/RibbonBar/IconMSOffice/16/ruler.png"
                                Text="Borders" telerik:KeyTipService.AccessText="B">
     
                        </telerik:RadRibbonButton>
                    </telerik:RadButtonGroup>
                </telerik:RadOrderedWrapPanel>
            </telerik:RadRibbonGroup>
            <telerik:RadRibbonGroup Header="Styles" telerik:ScreenTip.Title="Styles"
                    telerik:ScreenTip.Description="Show the Styles window."
                    telerik:ScreenTip.Icon="images/telerik/RibbonBar/IconMSOffice/StylesScreenTipIcon.png"
                    DialogLauncherVisibility="Visible" LaunchDialog="RibbonGroup_LaunchDialog"
                    telerik:KeyTipService.AccessText="FY" telerik:KeyTipService.AltAccessText="ZS">
                <telerik:RadRibbonGroup.Variants>
                    <telerik:GroupVariant Variant="Medium" Priority="4" />
                    <telerik:GroupVariant Variant="Collapsed" Priority="5" />
                </telerik:RadRibbonGroup.Variants>
                <telerik:RadRibbonGallery Title="Quick Styles" ActivatePreview="QuickStyles_ActivatePreview"
                        DeactivatePreview="QuickStyles_DeactivatePreview" x:Name="QuickStyles"
                        telerik:ScreenTip.Title="Quick Styles"
                        telerik:ScreenTip.Description="Format titles, quotes, and other text using this gallery of styles."
                        ItemWidth="72" ItemHeight="56" Icon="images/telerik/RibbonBar/IconMSOffice/users.png"
                        telerik:KeyTipService.AccessText="L">
                    <telerik:RadRibbonGallery.PopupMenuItems>
                        <telerik:RadMenuItem Header="Save Selection as a Quick Style..."
                                telerik:KeyTipService.AccessText="Q" />
                        <telerik:RadMenuItem Header="Clear Formatting" telerik:KeyTipService.AccessText="C"/>
                        <telerik:RadMenuItem Header="Apply Styles..." telerik:KeyTipService.AccessText="A"/>
                    </telerik:RadRibbonGallery.PopupMenuItems>
                    <telerik:RadGalleryItem IsSelected="True" Name="Normal"
                            Image="images/telerik/RibbonBar/IconMSOffice/paragraph.png" ToolTipService.ToolTip="Normal" />
                    <telerik:RadGalleryItem Name="No_Spacing"
                            Image="images/telerik/RibbonBar/IconMSOffice/paragraph9.png"
                            ToolTipService.ToolTip="No Spacing" />
                    <telerik:RadGalleryItem Name="Heading1" Image="images/telerik/RibbonBar/IconMSOffice/paragraph8.png"
                            ToolTipService.ToolTip="Heading 1" />
                    <telerik:RadGalleryItem Name="Heading2" Image="images/telerik/RibbonBar/IconMSOffice/paragraph7.png"
                            ToolTipService.ToolTip="Heading 2" />
                    <telerik:RadGalleryItem Name="Title" Image="images/telerik/RibbonBar/IconMSOffice/paragraph6.png"
                            ToolTipService.ToolTip="Title" />
                    <telerik:RadGalleryItem Name="Subtitle" Image="images/telerik/RibbonBar/IconMSOffice/paragraph5.png"
                            ToolTipService.ToolTip="Subtitle" />
                    <telerik:RadGalleryItem Name="Subtitle_Emphasis"
                            Image="images/telerik/RibbonBar/IconMSOffice/paragraph4.png"
                            ToolTipService.ToolTip="Subtitle Emphasis" />
                    <telerik:RadGalleryItem Name="Emphasis" Image="images/telerik/RibbonBar/IconMSOffice/paragraph3.png"
                            ToolTipService.ToolTip="Emphasis" />
                    <telerik:RadGalleryItem Name="Intense_Emphasis"
                            Image="images/telerik/RibbonBar/IconMSOffice/paragraph2.png"
                            ToolTipService.ToolTip="Intense Emphasis" />
                    <telerik:RadGalleryItem Name="Strong" Image="images/telerik/RibbonBar/IconMSOffice/paragraph1.png"
                            ToolTipService.ToolTip="Strong" />
                </telerik:RadRibbonGallery>
                <telerik:RadRibbonButton Text="Change Styles" Size="Large"
                        LargeImage="images/telerik/RibbonBar/IconMSOffice/32/ChangeStyles32.png"
                        telerik:KeyTipService.AccessText="G">
     
                </telerik:RadRibbonButton>
            </telerik:RadRibbonGroup>
            <telerik:RadRibbonGroup Header="Editing" telerik:KeyTipService.AltAccessText="ZN">
                <telerik:RadRibbonGroup.Variants>
                    <telerik:GroupVariant Variant="Collapsed" Priority="1" />
                </telerik:RadRibbonGroup.Variants>
                <telerik:RadCollapsiblePanel>
                    <telerik:RadRibbonSplitButton SmallImage="images/telerik/RibbonBar/IconMSOffice/16/find.png"
                            Text="Find" telerik:KeyTipService.AccessText="FD">
                        <telerik:RadRibbonSplitButton.DropDownContent>
                            <telerik:RadContextMenu BorderThickness="0">
                                <telerik:RadMenuItem Header="Find..." telerik:KeyTipService.AccessText="F">
                                    <telerik:RadMenuItem.Icon>
                                        <Image Stretch="None" Source="images/telerik/RibbonBar/IconMSOffice/16/find.png" />
                                    </telerik:RadMenuItem.Icon>
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem Header="Go To..." telerik:KeyTipService.AccessText="G"/>
                            </telerik:RadContextMenu>
                        </telerik:RadRibbonSplitButton.DropDownContent>
                    </telerik:RadRibbonSplitButton>
                    <telerik:RadRibbonButton SmallImage="images/telerik/RibbonBar/IconMSOffice/16/findnext.png"
                            Text="Replace" telerik:KeyTipService.AccessText="R" />
                    <telerik:RadRibbonSplitButton SmallImage="images/telerik/RibbonBar/IconMSOffice/16/pointer.png"
                            Text="Select" IsTextInMiddleButton="False" telerik:KeyTipService.AccessText="SL">
                        <telerik:RadRibbonSplitButton.DropDownContent>
                            <telerik:RadContextMenu BorderThickness="0">
                                <telerik:RadMenuItem Header="Select All" telerik:KeyTipService.AccessText="A">
                                    <telerik:RadMenuItem.Icon>
                                        <Image Stretch="None"
                                                Source="images/telerik/RibbonBar/IconMSOffice/16/pointer.png" />
                                    </telerik:RadMenuItem.Icon>
                                </telerik:RadMenuItem>
                                <telerik:RadMenuItem Header="Select Objects" telerik:KeyTipService.AccessText="O"/>
                                <telerik:RadMenuItem Header="Select Text with Similar Formatting"
                                        telerik:KeyTipService.AccessText="S" />
                            </telerik:RadContextMenu>
                        </telerik:RadRibbonSplitButton.DropDownContent>
                    </telerik:RadRibbonSplitButton>
                </telerik:RadCollapsiblePanel>
            </telerik:RadRibbonGroup>
        </telerik:RadRibbonTab>
    </telerik:RadRibbonBar>
    <telerik:RadRichTextBox Name="rtb" BorderThickness="1" Margin="0,141,0,0" />


    MainPage.xaml.cs
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
     
     
     
        private void RibbonGroup_LaunchDialog(object sender, RadRoutedEventArgs e)
        {
            RadWindow.Alert("Show Group Options");
        }
     
        private void QuickStyles_ActivatePreview(object sender, RadRoutedEventArgs e)
        {
            //RadGalleryItem galleryItem = (e.OriginalSource as RadGalleryItem);
            //if (galleryItem != null)
            //{
            //    string imageUriString = "/RibbonBar/IconMSOffice/" + galleryItem.Name + ".png";
            //    this.titleImage.Source = new BitmapImage(new Uri(imageUriString, UriKind.RelativeOrAbsolute));
            //}
        }
     
        private void QuickStyles_DeactivatePreview(object sender, RadRoutedEventArgs e)
        {
            //RadRibbonGallery gallery = (sender as RadRibbonGallery);
            //if (gallery.SelectedItem != null)
            //{
            //    string imageUriString = "/RibbonBar/IconMSOffice/" + (gallery.SelectedItem as RadGalleryItem).Name + ".png";
            //    this.titleImage.Source = new BitmapImage(new Uri(imageUriString, UriKind.RelativeOrAbsolute));
            //}
            //else
            //{
            //    this.titleImage.Source = null;
            //}
        }
    }

    Here is my screen shot:
    http://i12.photobucket.com/albums/a201/le9569/10-20-20101-53-34PM.png

    Please let me know if I am missing something.

    Thanks.
    John.
  2. Answer
    Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 22 Oct 2010 Link to this post

    Hi John,

    We are very glad to hear that you like our products. As for the catching up, feel free to contact us anytime.

    Looking through your code, I have a few comments.
        First of all, I think you should consider using RadRichTextBoxRibbonUI instead of RadRibbonBar. RadRichTextBoxRibbonUI inherits its functionality from RadRibbonBar, but is specifically designed to work with RadRichTextBox. (All you need to change in your code is to alter the opening and closing tag and add a reference to Telerik.Windows.Controls.RichTextBoxUI.dll).
        Second, in order to make the buttons work, you have to explicitly assign them. The preferred way to do that is by binding their telerik:RadRichTextBoxRibbonUI.RichTextCommand property to the command that RadRichTextBox exposes. For more information and examples, see http://www.telerik.com/help/silverlight/radrichtextbox-features-commands.html.


    All the best,
    Iva
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top