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

[Solved] Alignment problem in RadRichTextBox

12 Answers 362 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dennis
Top achievements
Rank 1
Dennis asked on 23 Feb 2011, 07:01 AM
Hi,

I am using a radrichtextbox inside a RadPane(Docking Control). I am using the Document property of radrichtextbox to display the contents since i need the HTML Support. Now the problem is that i want to display the content at the center of the RadPane both vertically and horizontally but unable to achieve this effect. If i am using the controls like TextBlock,Label,etc i am able to align the content at the center but through radrichtextbox i am not. Can you please help me out.

Thanks in advance. 

12 Answers, 1 is accepted

Sort by
0
Andrew
Telerik team
answered on 23 Feb 2011, 01:33 PM
Hello David,

 We were not able to reproduce your issue. We are using the following code:

<Grid x:Name="LayoutRoot">
    <telerik:RadDocking>
        <telerik:RadDocking.DocumentHost>
            <telerik:RadPaneGroup>
                <telerik:RadPane Header="RadPane1">
                    <TextBox HorizontalAlignment="Center" VerticalAlignment="Center" />
                </telerik:RadPane>
                <telerik:RadPane Header="RadPane2">
                    <telerik:RadRichTextBox HorizontalAlignment="Center" VerticalAlignment="Center" />
                </telerik:RadPane>
                <telerik:RadPane Header="RadPane3">
                    <TextBlock Text="This is test!" HorizontalAlignment="Center" VerticalAlignment="Center" />
                </telerik:RadPane>
            </telerik:RadPaneGroup>
        </telerik:RadDocking.DocumentHost>
    </telerik:RadDocking>
</Grid>

and everything seems to be working as expected. Every control here is in the center of the RadPane(Docking control). If we have misunderstood you in some way, please get back to us so we can assist you further.

Kind regards,
Andrew
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Dennis
Top achievements
Rank 1
answered on 06 Mar 2011, 09:32 AM
Hi,

Well so can you send me example which solves this issue. Let me clear that i am using a document property(RadRichTextBox1.Document) of RadRichTextBox to display the data since i needed a support for Html. So please send me the exaple where you are using the Document Property for RadRichTextBox and also please the RadRichTextBox has to be inside RadDocking.

Thanks.
0
Iva Toteva
Telerik team
answered on 07 Mar 2011, 04:25 PM
Hi David,

 
Actually, the code-snippet Andrew provided in his post works if you are using the Q1 Beta (2011.1.0223). If you upgrade to it, you can see how RadRichTextBox gets centered both vertically and horizontally.

In previous versions of the control, you can center the rich text box vertically if you put it in a Grid with VerticalAlignment="Center" and in a row with Height="Auto" like this:

Copy Code
<Grid VerticalAlignment="Center">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
   
    <Border BorderBrush="Red" BorderThickness="1">
        <telerik:RadRichTextBox Name="editor" />
    </Border>
</Grid>

However, it would not be possible to adopt the same approach for the Width and the rich text box would stretch across the screen.
Please find attached a small demo illustrating how the Horizontal and VerticalAlignment properties work. Do not forget to set the references to point to the 0223 version of the assemblies. In the example, the HTML that is loaded in the rich text box is included as a file in the project. If you want to use data-binding, you should use a data provider, as described in this help article.
If you need further assistance, do not hesitate to get back to us.

All the best,
Iva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Dennis
Top achievements
Rank 1
answered on 08 Mar 2011, 06:42 AM
I am currently using 2010.3.1110.1040 version for Silverlight. Well how to download the version(2011.1.0223) you specified? I cannot find this version in my license account. How can i solve this problem with my current version inside a Radocking Control. Urgent solution would be really appreciated. I have used RadHtmlPlaceHolder in the past but due to the problems in that control of compulsorily setting windowless property and all i was been suggested to use RadRichTextBox by your team and now this control seems to have all these alignment problems which is really now turning out to be frustrating. 

 
0
Iva Toteva
Telerik team
answered on 09 Mar 2011, 02:07 PM
Hi David,

You can download an automatic or manual installer from your account under the header "Beta".
With the current version of the controls you are using, you can only center the content horizontally, as in the code-snippet in my previous post.
Let us know if you need anything else.

Best wishes,
Iva
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
JanwalkarPooja
Top achievements
Rank 2
answered on 05 Jul 2013, 04:56 AM
Hi Team,

 In my project i am also facing alignment problem inside RadRichTextBox.
 <telerik:RadRichTextBox x:Name="richTextBox" ScrollViewer.VerticalScrollBarVisibility="Auto"
                                                                                    Grid.Row="0" Width="980" MaxWidth="980"
                                                                                    Grid.Column="0" Padding="10,0,0,0"
                                                                                    Height="100" VerticalContentAlignment="Stretch" VerticalAlignment="Center"    HorizontalContentAlignment="Center"
                                                                                    IsReadOnly="True" HorizontalAlignment="Right"
                                                                                    IsSpellCheckingEnabled="False"                                                                                                                                                                        
                                                                                      IsSelectionMiniToolBarEnabled="False"                                                                                                                                                  
                                                                                    IsContextMenuEnabled="False"
                                                                                    IsSelectionEnabled="False"
                                                                                    />
                                                            <telerikhtml:HtmlDataProvider x:Name="HtmlDataProvider"
                                                                                          Html="{Binding EmailBody}"
                                                                                          RichTextBox="{Binding ElementName=richTextBox}" />

Inside RichTextBox control, table structure is build with code behind binding.
I need Content of table should properly aligned with header.
PFA of image,in that After maximize (expanding) particular one row Grid RadRichTextBox shows up.In that,Column 1 Header content and value is misaligned with table structure.
Please provide the solution for this issue.
I am looking forward your reply.

0
JanwalkarPooja
Top achievements
Rank 2
answered on 10 Jul 2013, 08:44 AM
Hi Team,

 In my project i am also facing alignment problem inside RadRichTextBox.
 <telerik:RadRichTextBox x:Name="richTextBox" ScrollViewer.VerticalScrollBarVisibility="Auto"
                                                                                    Grid.Row="0" Width="980" MaxWidth="980"
                                                                                    Grid.Column="0" Padding="10,0,0,0"
                                                                                    Height="100" VerticalContentAlignment="Stretch" VerticalAlignment="Center"    HorizontalContentAlignment="Center"
                                                                                    IsReadOnly="True" HorizontalAlignment="Right"
                                                                                    IsSpellCheckingEnabled="False"                                                                                                                                                                        
                                                                                      IsSelectionMiniToolBarEnabled="False"                                                                                                                                                  
                                                                                    IsContextMenuEnabled="False"
                                                                                    IsSelectionEnabled="False"
                                                                                    />
                                                            <telerikhtml:HtmlDataProvider x:Name="HtmlDataProvider"
                                                                                          Html="{Binding EmailBody}"
                                                                                          RichTextBox="{Binding ElementName=richTextBox}" />

Inside RichTextBox control, table structure is build with code behind binding.
I need Content of table should properly aligned with header.
PFA of image.
Please provide the solution for this issue.
I am looking forward your reply.


Regards,
Pooja
0
Amruta
Top achievements
Rank 1
answered on 27 Mar 2015, 06:14 AM
Hi I am using RadRichTextBox inside stackpanel. 
When I open ribbon menu , height of textbox increases I want to keep height same even if editor ribbon open or close
Can anybody please help, this is urgent???

Thanks.
0
Petya
Telerik team
answered on 31 Mar 2015, 07:56 AM
Hello Amruta,

I'm having troubles understanding the issue you are facing. Could you share more information on the setup? What is the height of the control prior opening the ribbon and how are the controls positioned? It might help if you share your XAML and some images of the observed behavior.

Regards,
Petya
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Amruta
Top achievements
Rank 1
answered on 31 Mar 2015, 08:20 AM
Hi,

Ok I will explain probelm in detail.
I have RadRichTextbox with RadRibbon minimized. I want to set ribbon open(Isminimized="false") when user click on any button/tab of RadRibbon. Like if I click on Home tab then ribbon should be open (Isminimized="false") so that cursor will automatically set to appropriate location. Please see screen shot. 
0
Petya
Telerik team
answered on 03 Apr 2015, 08:19 AM
Hi Amruta,

Moving the caret to the location shown on the image is not possible. By default when the ribbon is minimized and you click on it, it is shown as a popup, so it's expected for it to be over the editor. In fact, the behavior is the same in most word processors, for example MS Word.

Try subscribing to the PreviewPopupOpened event of the ribbon and setting IsMinimized to false to see if it fits your needs:
private void RadRichTextBoxRibbonUI_PreviewPopupOpened(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
    this.radRichTextBoxRibbonUI.IsMinimized = false;
     
    e.Handled = true;
}

Regards,
Petya
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
Amruta
Top achievements
Rank 1
answered on 03 Apr 2015, 08:59 AM
Hi Petya Thanks a lot ...thats working fine. 
I guess what I was missing in my all attempts is e.Handled = true;

Anyways thanks again !
Tags
RichTextBox
Asked by
Dennis
Top achievements
Rank 1
Answers by
Andrew
Telerik team
Dennis
Top achievements
Rank 1
Iva Toteva
Telerik team
JanwalkarPooja
Top achievements
Rank 2
Amruta
Top achievements
Rank 1
Petya
Telerik team
Share this question
or