This is a migrated thread and some comments may be shown as answers.

RadRichTextBoxRibbonUI Insert Comment

7 Answers 156 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Patricia
Top achievements
Rank 1
Patricia asked on 06 Feb 2012, 08:36 PM
I can insert a comment but when I try to type in the comment I can only type one letter and then the cursor moves back to the document area.
<telerikHTML:HtmlDataProvider Name="dp1" Html="{Binding TaskText, Mode=TwoWay}" RichTextBox="{Binding ElementName=TaskEditor}" />
<telerik:RadRichTextBox x:Name="TaskEditor" Grid.Row="1" Grid.Column="1" Margin="0,5,0,5"
                    AllowDrop="True"  ShowComments="True"
                    IsSelectionMiniToolBarEnabled="false"
                    LayoutMode="Flow"
                    DocumentInheritsDefaultStyleSettings="True"
                    GotFocus="EditorGotFocus" LostFocus="EditorLostFocus"/>
private void EditorGotFocus(object sender, RoutedEventArgs e)
      {
          _lastDataContext = _contextualTabView.DataContext;
          _contextualTabView.DataContext = TaskEditor.Commands;
          _lastTab = _ribbonView.SelectedTab;
          _contextualGroup.IsActive = true;
      }
 
      private void EditorLostFocus(object sender, RoutedEventArgs e)
      {
          _contextualGroup.IsActive = false;
          _lastTab.IsSelected = true;
          _contextualTabView.DataContext = _lastDataContext;
      }

7 Answers, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 10 Feb 2012, 02:13 PM
Hi Patricia,

Unfortunately, I am not sure that I understand your scenario. I tried using the code in your snippet, but was not able to reproduce the behavior.
However, handling the editor's LostFocus and GotFocus can be a little tricky, because the headers and footers, as well as the comments are represented by other editors. Therefore, the GotFocus and LostFocus events of the editor are fired more often (one of the cases is exactly when you focus a comment or get back to the main document).
 Could you provide some more details on the RadRichTextBoxRibbonUI of your case and specify the version of WPF controls you are using. It will be great to send us a simple demo through a support ticked, so we can investigate the issue further.

Looking forward for your reply.

Regards,
Iva Toteva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Patricia
Top achievements
Rank 1
answered on 10 Feb 2012, 04:14 PM
How else I can get the contextual tab to turn off and on?
0
Iva Toteva
Telerik team
answered on 13 Feb 2012, 09:26 AM
Hello Patricia,

In general, when you need to find out if the focus is in the rich text box, you can use FrameworkElement.IsKeyboardFocusWithin to find if RadRichTextBox is focused. For example, you can implement the LostFocus method like this:

private void EditorLostFocus(object sender, RoutedEventArgs e)
{
    RadRichTextBox richTextBox = (RadRichTextBox)sender;
    if (richTextBox.IsKeyboardFocusWithin)
    {
        return;
    }
    _contextualGroup.IsActive = false;
    _lastTab.IsSelected = true;
    _contextualTabView.DataContext = _lastDataContext;
}

If this does not work for you, we would appreciate a demo project.

Kind regards,
Iva Toteva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Patricia
Top achievements
Rank 1
answered on 13 Feb 2012, 05:39 PM
I would also like to note that when I click in the RichTextBox the cursor does not show up.  I actually have to start typing before I see the cursor. 

This example should show you the issue with typing inside of a comment as well as the cursor not showing up.

<Window x:Class="DockingExample.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                xmlns:local="clr-namespace:DockingExample"
                WindowState="Maximized"
                Title="RichTextBox Example" Height="700" Width="1030">
    <Grid>
        <Grid.Resources>
            <DataTemplate x:Key="GridDetailRowInfo">
                <local:GridDetailRowInfo />
            </DataTemplate>
        </Grid.Resources>
 
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
 
 
        <telerik:RadRibbonView
            Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Top" Name="radRibbonView1" 
            ApplicationName="" Title="" IsMinimizable="False" ApplicationButtonVisibility="Collapsed" >
            <telerik:RadRibbonView.Resources>
                <telerik:FontFamiliesProvider x:Key="FontFamiliesProvider" />
            </telerik:RadRibbonView.Resources>
            <telerik:RadRibbonView.ContextualGroups>
                <telerik:RadRibbonContextualGroup Header="Editing Tools" x:Name="CommentEditing">
 
                </telerik:RadRibbonContextualGroup>
            </telerik:RadRibbonView.ContextualGroups>
 
            <telerik:RadRibbonTab Header="Home"/>
            <telerik:RadRibbonTab Header="Tab 1" IsSelected="True">
                <telerik:RadRibbonGroup Header="Select" >
                    <telerik:RadRibbonSplitButton Text="Select" Size="Large" >
 
                    </telerik:RadRibbonSplitButton>
                </telerik:RadRibbonGroup>
 
            </telerik:RadRibbonTab>
            <telerik:RadRibbonTab Header="Reports"/>
            <telerik:RadRibbonTab Header="Setup"/>
            <telerik:RadRibbonTab Header="  Editing Tools  " ContextualGroupName="CommentEditing" x:Name="CommentEditingTab">
                <telerik:RadRibbonGroup Header="Clipboard" >
                    <telerik:RadRibbonGroup.Variants>
                        <telerik:GroupVariant Priority="0" Variant="Medium" />
                    </telerik:RadRibbonGroup.Variants>
                    <StackPanel>
                        <telerik:RadRibbonButton CollapseToSmall="WhenGroupIsMedium" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=CutCommand}" telerik:ScreenTip.Description="Cut the selection and put it on the Clipboard." telerik:ScreenTip.Title="Cut" Size="Medium" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/cut.png" Text="Cut" />
                        <telerik:RadRibbonButton CollapseToSmall="WhenGroupIsMedium" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=CopyCommand}" telerik:ScreenTip.Description="Copy the selection and put it on the Clipboard." telerik:ScreenTip.Title="Copy" Size="Medium" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/copy.png" Text="Copy" />
                        <telerik:RadRibbonButton CollapseToSmall="WhenGroupIsMedium" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=PasteCommand}" telerik:ScreenTip.Description="Paste the contents of the Clipboard." telerik:ScreenTip.Title="Paste" Size="Medium" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/paste.png" Text="Paste" />
                    </StackPanel>
                </telerik:RadRibbonGroup>
                <telerik:RadRibbonGroup DialogLauncherVisibility="Visible" Header="Font"
                                         
                                        telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ShowFontPropertiesDialogCommand}"
                                        telerik:ScreenTip.Description="Show the font dialog box."
                                        telerik:ScreenTip.Icon="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/FontDialog.png"
                                        telerik:ScreenTip.Title="Font">
                    <telerik:RadRibbonGroup.Variants>
                        <telerik:GroupVariant Priority="4" Variant="Medium" />
                        <telerik:GroupVariant Priority="6" Variant="Small" />
                        <telerik:GroupVariant Priority="7" Variant="Collapsed" />
                    </telerik:RadRibbonGroup.Variants>
                    <telerik:RadOrderedWrapPanel>
                        <StackPanel Orientation="Horizontal">
                            <telerik:RadRibbonComboBox CanAutocompleteSelectItems="False" CanKeyboardNavigationSelectItems="False" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=SelectedValue}" Height="21" IsReadOnly="True" ItemsSource="{Binding Source={StaticResource FontFamiliesProvider}, Path=RegisteredFonts}" OpenDropDownOnFocus="True" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeFontFamilyCommand}" telerik:ScreenTip.Description="Change the font family." telerik:ScreenTip.Title="Font" Width="132" />
                            <telerik:RadRibbonComboBox CanAutocompleteSelectItems="False" CanKeyboardNavigationSelectItems="False" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=SelectedItem.Tag}" Height="21" IsEditable="True" IsReadOnly="True" IsTextSearchEnabled="False" OpenDropDownOnFocus="True" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeFontSizeCommand}" telerik:ScreenTip.Description="Change the font size." telerik:ScreenTip.Title="Font Size" Width="45">
                                <telerik:RadRibbonComboBoxItem Content="8" Tag="10.67" />
                                <telerik:RadRibbonComboBoxItem Content="9" Tag="12" />
                                <telerik:RadRibbonComboBoxItem Content="10" Tag="13.33" />
                                <telerik:RadRibbonComboBoxItem Content="11" Tag="14.67" />
                                <telerik:RadRibbonComboBoxItem Content="12" Tag="16" />
                                <telerik:RadRibbonComboBoxItem Content="14" Tag="18.67" />
                                <telerik:RadRibbonComboBoxItem Content="16" Tag="21.33" />
                                <telerik:RadRibbonComboBoxItem Content="18" Tag="24" />
                                <telerik:RadRibbonComboBoxItem Content="20" Tag="26.67" />
                                <telerik:RadRibbonComboBoxItem Content="22" Tag="29.33" />
                                <telerik:RadRibbonComboBoxItem Content="24" Tag="32" />
                                <telerik:RadRibbonComboBoxItem Content="26" Tag="34.67" />
                                <telerik:RadRibbonComboBoxItem Content="28" Tag="37.33" />
                                <telerik:RadRibbonComboBoxItem Content="36" Tag="48" />
                                <telerik:RadRibbonComboBoxItem Content="48" Tag="64" />
                                <telerik:RadRibbonComboBoxItem Content="72" Tag="96" />
                            </telerik:RadRibbonComboBox>
                        </StackPanel>
                        <telerik:RadButtonGroup>
                            <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=IncrementFontSizeCommand}" telerik:ScreenTip.Description="Increase the font size." telerik:ScreenTip.Title="Grow Font" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/font-increasesize.png" />
                            <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=DecrementFontSizeCommand}" telerik:ScreenTip.Description="Decrease the font size." telerik:ScreenTip.Title="Shrink Font" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/font-decreasesize.png" />
                        </telerik:RadButtonGroup>
                        <telerik:RadButtonGroup>
                            <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ClearFormattingCommand}" telerik:ScreenTip.Description="Clear all the formatting from the selection, leaving only the plain text." telerik:ScreenTip.Title="Clear Formatting" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/ClearFormatting16.png" />
                        </telerik:RadButtonGroup>
                        <telerik:RadButtonGroup>
                            <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleBoldCommand}" telerik:ScreenTip.Description="Make the selected text bold." telerik:ScreenTip.Title="Bold" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/bold.png" />
                            <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleItalicCommand}" telerik:ScreenTip.Description="Italicize the selected text." telerik:ScreenTip.Title="Italic" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/italic.png" />
                            <telerik:RadRibbonSplitButton IsToggle="True" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleUnderlineCommand}" telerik:ScreenTip.Description="Underline the selected text." telerik:ScreenTip.Title="Underline" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/underline.png">
                                <telerik:RadRibbonSplitButton.DropDownContent>
                                    <telerik:RadGallery ItemHeight="26" ItemWidth="156" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeUnderlineDecorationCommand}" ViewportHeight="210" ViewportWidth="157">
                                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/underline1.png" Tag="Line" />
                                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/underline2.png" Tag="DoubleLine" />
                                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/underline3.png" Tag="ThickLine" />
                                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/underline4.png" Tag="DottedLine" />
                                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/underline5.png" Tag="DashedLine" />
                                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/underline6.png" Tag="DotDashedLine" />
                                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/underline7.png" Tag="DotDotDashedLine" />
                                        <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/underline8.png" Tag="Wave" />
                                    </telerik:RadGallery>
                                </telerik:RadRibbonSplitButton.DropDownContent>
                            </telerik:RadRibbonSplitButton>
                            <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleStrikethroughCommand}" telerik:ScreenTip.Description="Draw a line through the middle of the selected text." telerik:ScreenTip.Title="Strikethrough" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/Strikethrough16.png" />
                            <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleSubscriptCommand}" telerik:ScreenTip.Description="Create small letters below the text baseline." telerik:ScreenTip.Title="Subscript" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/subscript.png" />
                            <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleSuperscriptCommand}" telerik:ScreenTip.Description="Create small text above the line of text." telerik:ScreenTip.Title="Superscript" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/superscript.png" />
                        </telerik:RadButtonGroup>
                        <telerik:RadButtonGroup>
                            <telerik:HighlightColorPicker AutomaticColor="Transparent" Height="22" Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/highlight.png" NoColorText="No color" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeFontHighlightColorCommand}" telerik:ScreenTip.Description="Make text look like it was marked with a highlighter pen." telerik:ScreenTip.Title="Text Highlight Color" SelectedColor="Yellow" />
                            <telerik:HighlightColorPicker Height="22" Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/FontForeColor.png" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeFontForeColorCommand}" telerik:ScreenTip.Description="Change the text color." telerik:ScreenTip.Title="Font Color" SelectedColor="Red" />
                        </telerik:RadButtonGroup>
                    </telerik:RadOrderedWrapPanel>
                </telerik:RadRibbonGroup>
                <telerik:RadRibbonGroup DialogLauncherVisibility="Visible" Header="Paragraph"
                                        telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ShowParagraphPropertiesDialogCommand}"
                                        telerik:ScreenTip.Description="Show the Paragraph dialog box."
                                        telerik:ScreenTip.Icon="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/PropertiesDialog.png"
                                        telerik:ScreenTip.Title="Paragraph">
                    <telerik:RadRibbonGroup.Variants>
                        <telerik:GroupVariant Priority="3" Variant="Medium" />
                        <telerik:GroupVariant Priority="5" Variant="Collapsed" />
                    </telerik:RadRibbonGroup.Variants>
                    <telerik:RadOrderedWrapPanel>
                        <telerik:RadButtonGroup>
                            <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleBulletsCommand}" telerik:ScreenTip.Description="Start a bulleted list." telerik:ScreenTip.Title="Bullets" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/list-bullets.png" />
                            <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleNumberedCommand}" telerik:ScreenTip.Description="Start a numbered list." telerik:ScreenTip.Title="Numbering" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/list-numbered.png" />
                            <telerik:RadRibbonDropDownButton telerik:ScreenTip.Description="Start a multilevel list. Click the arrow to choose different multilevel list styles." telerik:ScreenTip.Title="Multilevel List" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/MultilevelList.png">
                                <telerik:RadRibbonDropDownButton.DropDownContent>
                                    <StackPanel>
                                        <telerik:RadGroupHeader Content="List Library" />
                                        <telerik:RadGallery ItemHeight="88" ItemWidth="88" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeListStyleCommand}" ViewportHeight="176" ViewportWidth="266">
                                            <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNone.png" Tag="None" />
                                            <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListBulleted.png" Tag="Bulleted" />
                                            <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNumbered.png" Tag="Numbered" />
                                            <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNumberedParenthesis.png" Tag="NumberedParenthesis" />
                                            <telerik:RadGalleryItem Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/MultilevelListNumberedHierarchical.png" Tag="NumberedHierarchical" />
                                        </telerik:RadGallery>
                                    </StackPanel>
                                </telerik:RadRibbonDropDownButton.DropDownContent>
                            </telerik:RadRibbonDropDownButton>
                        </telerik:RadButtonGroup>
                        <telerik:RadButtonGroup>
                            <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=DecrementParagraphLeftIndentCommand}" telerik:ScreenTip.Description="Decrease the indent level of the paragraph." telerik:ScreenTip.Title="Decrease Indent" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/outdent.png" />
                            <telerik:RadRibbonButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=IncrementParagraphLeftIndentCommand}" telerik:ScreenTip.Description="Increase the indent level of the paragraph." telerik:ScreenTip.Title="Increase Indent" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/indent.png" />
                        </telerik:RadButtonGroup>
                        <telerik:RadButtonGroup>
                            <telerik:RadRibbonToggleButton CommandParameter="LeftToRight" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeParagraphFlowDirectionCommand}" telerik:ScreenTip.Description="Set the direction of text to be displayed from left to right." telerik:ScreenTip.Title="Left-To-Right Text Direction" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/LeftToRightFlowDirection.png" Text="Left-to-Right Text Direction" />
                            <telerik:RadRibbonToggleButton CommandParameter="RightToLeft" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeParagraphFlowDirectionCommand}" telerik:ScreenTip.Description="Set the direction of text to be displayed from right to left." telerik:ScreenTip.Title="Right-To-Left Text Direction" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/RightToLeftFlowDirection.png" Text="Right-to-Left Text Direction" />
                        </telerik:RadButtonGroup>
                        <telerik:RadButtonGroup>
                            <telerik:RadRibbonToggleButton telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleFormattingSymbolsCommand}" telerik:ScreenTip.Description="Show paragraph marks and other hidden formatting symbols." telerik:ScreenTip.Title="Show/Hide Formatting Symbols" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/formatting-symbols.png" />
                        </telerik:RadButtonGroup>
                        <telerik:RadButtonGroup>
                            <telerik:RadRibbonToggleButton CommandParameter="Left" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeTextAlignmentCommand}" telerik:ScreenTip.Description="Align text to the left." telerik:ScreenTip.Title="Align Text Left" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/alignleft.png" Text="Align Left" />
                            <telerik:RadRibbonToggleButton CommandParameter="Center" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeTextAlignmentCommand}" telerik:ScreenTip.Description="Center text." telerik:ScreenTip.Title="Center" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/aligncenter.png" Text="Center" />
                            <telerik:RadRibbonToggleButton CommandParameter="Right" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeTextAlignmentCommand}" telerik:ScreenTip.Description="Align text to the right." telerik:ScreenTip.Title="Align Text Right" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/alignright.png" Text="Align Right" />
                            <telerik:RadRibbonToggleButton CommandParameter="Justify" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeTextAlignmentCommand}" telerik:ScreenTip.Description="Align text to both left and right margins, adding extra space between words as necessary." telerik:ScreenTip.Title="Justify" Size="Small" SmallImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/alignjustify.png" Text="Justify" />
                        </telerik:RadButtonGroup>
                        <telerik:RadButtonGroup>
                            <telerik:HighlightColorPicker AutomaticColor="Transparent" Height="20" Image="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/16/ParagraphBackgroundColor.png" NoColorText="No color" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ChangeParagraphBackgroundColorCommand}" telerik:ScreenTip.Description="Color the background behind the selected text or paragraph." telerik:ScreenTip.Title="Shading" SelectedColor="Transparent" />
                        </telerik:RadButtonGroup>
                    </telerik:RadOrderedWrapPanel>
                </telerik:RadRibbonGroup>
                <telerik:RadRibbonGroup Header="Proofing" >
                    <telerik:RadRibbonButton LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/EnableSpellCheck.png" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ShowSpellCheckingDialogCommand}" telerik:ScreenTip.Description="Check the spelling of text in the document." telerik:ScreenTip.Title="Spelling" Size="Large" Text="Spell Check" />
                </telerik:RadRibbonGroup>
                <telerik:RadRibbonGroup Header="Comments" >
                    <telerik:RadRibbonButton LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/NewComment.png" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=InsertCommentCommand}" telerik:ScreenTip.Description="Add a comment about the selection." telerik:ScreenTip.Title="Insert Comment" Size="Large" Text="New Comment" />
                    <telerik:RadRibbonButton LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/DeleteComment.png" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=DeleteCommentCommand}" telerik:ScreenTip.Description="Delete the selected comment." telerik:ScreenTip.Title="Delete Comment" Size="Large" Text="Delete" />
                    <telerik:RadRibbonButton LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/PreviousComment.png" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=GoToPreviousCommentCommand}" telerik:ScreenTip.Description="Navigate to the previous comment in the document." telerik:ScreenTip.Title="Previous Comment" Size="Large" Text="Previous" />
                    <telerik:RadRibbonButton LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/NextComment.png" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=GoToNextCommentCommand}" telerik:ScreenTip.Description="Navigate to the next comment in the document." telerik:ScreenTip.Title="Next Comment" Size="Large" Text="Next" />
                    <telerik:RadRibbonToggleButton LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/ShowHideComments.png" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=ToggleCommentsCommand}" telerik:ScreenTip.Description="Click here to show or hide the comments." telerik:ScreenTip.Title="Show/Hide Comments" Size="Large" Text="Show/Hide Comments" />
                    <telerik:RadRibbonButton LargeImage="pack://application:,,,/Telerik.Windows.Controls.RichTextBoxUI;component/Images/MSOffice/32/DeleteAllComments.png" telerik:RadRichTextBoxRibbonUI.RichTextCommand="{Binding Path=DeleteAllCommentsCommand}" telerik:ScreenTip.Description="Click here to delete all of the comments in the document." telerik:ScreenTip.Title="Delete All Comments" Size="Large" Text="Delete All" />
                </telerik:RadRibbonGroup>
            </telerik:RadRibbonTab>
 
        </telerik:RadRibbonView>
 
        <telerik:RadDocking  BorderThickness="5" Padding="2"  HasDocumentHost="False" AllowUnsafeMode="True" Grid.Row="1">
 
            <telerik:RadSplitContainer Orientation="Vertical" InitialPosition="DockedTop"  MinWidth="400" >
                <telerik:RadPaneGroup  >
                    <telerik:RadPane Header="Reference Materials" x:Name="ReferenceMaterialsPanel"  >
                        <telerik:RadGridView DockPanel.Dock="Bottom" x:Name="RadGridView" ItemsSource="{Binding DataList}" AutoGenerateColumns="False"
                            RowIndicatorVisibility="Collapsed"
                            RowDetailsVisibilityMode="VisibleWhenSelected" 
                                             RowDetailsTemplate="{StaticResource GridDetailRowInfo}">
                            <telerik:RadGridView.Columns>
                                <telerik:GridViewToggleRowDetailsColumn/>
                                <telerik:GridViewDataColumn Header="Title" Width="250" DataMemberBinding="{Binding Column1}"/>
                                <telerik:GridViewDataColumn Header="Reference Type" Width="250" DataMemberBinding="{Binding Column2}"/>
                                <telerik:GridViewDataColumn Header="File Name" Width="250" DataMemberBinding="{Binding Column3}"/>
                                <telerik:GridViewDataColumn Header="Size" Width="100" DataMemberBinding="{Binding column4}"/>
                                <telerik:GridViewDataColumn Header="Last Modified" Width="150" DataMemberBinding="{Binding Column5}"/>
                            </telerik:RadGridView.Columns>
 
 
                        </telerik:RadGridView>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
            </telerik:RadSplitContainer>
 
        </telerik:RadDocking>
 
    </Grid>
</Window>


using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using Telerik.Windows.Documents.Model;
 
namespace DockingExample
{
     
    public class MainWindowViewModel : INotifyPropertyChanged
    {
 
        public event PropertyChangedEventHandler PropertyChanged;
        private void FirePropertyChanged(string property)
        {
            //Should only be called by ViewModel base class.  Derived classes should use lambda/LINQ syntax to simplify refactoring
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(property));
        }
 
        public MainWindowViewModel()
        {
            Comment = new RadDocument();
 
 
            DataList = new ObservableCollection<DataModel>();
 
            var dataModel1 = new DataModel
            {
                Column1 = "Manual",
                Column2 = "Manual",
                Column3 = "Manual.pdf",
                Column4 = "323432343",
                Column5 = "10/25/2008 11:15:23 AM"
            };
            var dataModel2 = new DataModel
                                 {
                                     Column1 = "Front",
                                     Column2 = "Photgraphs",
                                     Column3 = "front.jpg",
                                     Column4 = "323443",
                                     Column5 = "11/05/2008 08:03:23 AM"
                                 };
 
            DataList.Add(dataModel1);
            DataList.Add(dataModel2);
 
            FirePropertyChanged("DataList");
        }
 
        public ObservableCollection<DataModel> DataList { get; set; }
 
  
        public RadDocument Comment { get; set; }
    }
 
 
  
}
using
System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.DragDrop;
using Telerik.Windows.Documents.Layout;
using Telerik.Windows.Documents.Model;
 
 
namespace DockingExample
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindowViewModel ViewModel { get; set; }
 
        public static RadRibbonView radRibbonView2;
        public static RadRibbonTab editingTab;
 
        public MainWindow()
        {
 
            RadDragAndDropManager.EnableNativeDrag = true;
            ViewModel = new MainWindowViewModel();
            this.DataContext = ViewModel;
 
            ViewModel.Comment.LayoutMode = DocumentLayoutMode.Flow;
            ViewModel.Comment.ParagraphDefaultSpacingAfter = 5;
            ViewModel.Comment.PageViewMargin = new SizeF(1, 1);
            ViewModel.Comment.SectionDefaultPageMargin = new Padding(5);
 
            InitializeComponent();
 
            radRibbonView2 = radRibbonView1;
            editingTab = CommentEditingTab;
 
 
        }
    }
 
  }

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
 
namespace DockingExample
{
    public class DataModel : INotifyPropertyChanged
    {
 
        private string _column1 = "";
        public string Column1
        {
            get { return _column1; }
            set { _column1 = value; OnPropertyChanged("Column1"); }
        }
 
        private string _column2 = "";
        public string Column2
        {
            get { return _column2; }
            set { _column2 = value; OnPropertyChanged("Column2"); }
        }
 
        private string _column3;
        public string Column3
        {
            get { return _column3; }
            set { _column3 = value; OnPropertyChanged("Column3"); }
        }
        private string _column4;
        public string Column4
        {
            get { return _column4; }
            set { _column4 = value; OnPropertyChanged("Column4"); }
        }
        private string _column5;
        public string Column5
        {
            get { return _column5; }
            set { _column5 = value; OnPropertyChanged("Column5"); }
        }
 
        public event PropertyChangedEventHandler PropertyChanged;
 
        private void OnPropertyChanged(string property)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(property));
        }
    }
     
 
   
 
}

<UserControl xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"  x:Class="DockingExample.GridDetailRowInfo"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             Background="Transparent"
             mc:Ignorable="d"
             d:DesignHeight="165" d:DesignWidth="300">
    <Grid>
 
        <Border BorderThickness="2" Margin="3" BorderBrush="Black" CornerRadius="12" Padding="5" Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
            <telerik:RadTabControl Margin="2"  BackgroundVisibility="Hidden" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                <telerik:RadTabItem Header="Information">
                    <Grid Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Transparent" Margin="5">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="120"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
 
                        <TextBlock Text="Title: " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
                        <TextBlock Text="{Binding Column1}" Margin="5,0,0,0" Grid.Row="0" Grid.Column="1"  VerticalAlignment="Center" HorizontalAlignment="Left"/>
 
                        <TextBlock Text="Reference Material Type: " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
                        <TextBlock Text="{Binding Column2}" Margin="5,0,0,0" Grid.Row="1" Grid.Column="1"  VerticalAlignment="Center" HorizontalAlignment="Left"/>
 
                        <TextBlock Text="File Name: " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
                        <TextBlock Text="{Binding Column3}" Margin="5,0,0,0" Grid.Row="2" Grid.Column="1"  VerticalAlignment="Center" HorizontalAlignment="Left"/>
 
                        <TextBlock Text="Size: " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
                        <TextBlock Text="{Binding Column4}" Margin="5,0,0,0" Grid.Row="3" Grid.Column="1"  VerticalAlignment="Center" HorizontalAlignment="Left"/>
 
                        <TextBlock Text="Last Modified: " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
                        <TextBlock Text="{Binding Column5}" Margin="5,0,0,0" Grid.Row="4" Grid.Column="1"  VerticalAlignment="Center" HorizontalAlignment="Left"/>
 
 
                        <TextBlock Text="Editor: " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="5" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
                        <telerik:RadRichTextBox x:Name="editor" Grid.Row="5" Grid.Column="1" Margin="5" AllowDrop="True" ShowComments="False" GotFocus="editor_GotFocus" LostFocus="editor_LostFocus"  />
 
                    </Grid>
                </telerik:RadTabItem>
                <!--<telerik:RadTabItem Header="Referenced By">
 
                    <Grid Width="Auto" HorizontalAlignment="Stretch" Background="Transparent" Margin="5">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                            <RowDefinition Height="20"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
 
                        <TextBlock Text="Item 1" Margin="5,0,0,0" FontWeight="Bold" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
 
                        <TextBlock Text="Item 2 " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
 
                        <TextBlock Text="Item 3 " Margin="5,0,0,0" FontWeight="Bold" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
 
                        <TextBlock Text="Item 4" Margin="5,0,0,0" FontWeight="Bold" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
 
                        <TextBlock Text="Item 4" Margin="5,0,0,0" FontWeight="Bold" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Left"  />
 
                    </Grid>
                </telerik:RadTabItem>-->
 
            </telerik:RadTabControl>
        </Border>
 
    </Grid>
</UserControl>


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Telerik.Windows.Controls;
 
namespace DockingExample
{
    /// <summary>
    /// Interaction logic for GridDetailRowInfo.xaml
    /// </summary>
    public partial class GridDetailRowInfo : UserControl
    {
 
        readonly RadRibbonView _ribbonView;
        readonly RadRibbonContextualGroup _contextualGroup;
        readonly RadRibbonTab _contextualTabView;
 
        private readonly RadRibbonTab _orginalRibbonTab;
 
        public GridDetailRowInfo()
        {
            InitializeComponent();
 
            _ribbonView = MainWindow.radRibbonView2;
 
            _contextualTabView = MainWindow.editingTab;
            _contextualTabView.DataContext = editor.Commands;
 
            _contextualGroup = _ribbonView.ContextualGroups.First(@group => @group.Name == "CommentEditing");
 
 
            if (_orginalRibbonTab == null)
                _orginalRibbonTab = _ribbonView.SelectedTab;
            Telerik.Windows.Documents.Model.PointF location = this.editor.Document.CaretPosition.Location;
            this.editor.Document.CaretPosition.SetPosition(location);
 
        }
 
        private void editor_GotFocus(object sender, RoutedEventArgs e)
        {
            TurnContextualTabOn();
 
        }
 
        private void editor_LostFocus(object sender, RoutedEventArgs e)
        {
            RadRichTextBox richTextBox = (RadRichTextBox)sender;
            if (richTextBox.IsKeyboardFocusWithin)
            {
                return;
            }
            TurnContextualTabOff();
 
        }
 
        private void TurnContextualTabOn()
        {
            if (_contextualGroup.IsActive == false)
            {
                _contextualTabView.DataContext = editor.Commands;
                _contextualGroup.IsActive = true;
            }
 
        }
 
        private void TurnContextualTabOff()
        {
            if (_contextualGroup.IsActive)
                _contextualGroup.IsActive = false;
            if (_orginalRibbonTab != null)
                _orginalRibbonTab.IsSelected = true;
 
        }
    }
}
0
Martin Ivanov
Telerik team
answered on 16 Feb 2012, 05:53 PM
Hello Patricia,
Your first problem is a known issue and it has been fixed in the latest (Q1 2012) version of the controls so obtaining it should help you.
Regarding your second problem, we managed to reproduce this issue with the code you provided.
Unfortunately we couldn't manage to find a workaround, but will add it to our bug list and will try to resolve it for the next release.
For any other questions do not hesitate to contact us again.

All the best,
Martin
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Patricia
Top achievements
Rank 1
answered on 16 Feb 2012, 06:36 PM
I just updated to the 2012 controls. I now have a new problem.

 (major)
When I double click inside the richtextbox I get the following error.
Unable to cast object of type 'System.Windows.Documents.Run' to type 'System.Windows.FrameworkElement'.
0
Iva Toteva
Telerik team
answered on 17 Feb 2012, 06:40 PM
Hello Patricia,

We also noticed this issue thanks to the code and the sample project you have attached.
We have logged it and will look for a solution to the problem. We will get back to if we come to workaround.

Greetings,
Iva Toteva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
RichTextBox
Asked by
Patricia
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Patricia
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or