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
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>Kind regards,
Andrew
the Telerik team
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.
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:
<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
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.
Iva
the Telerik 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.
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
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.
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.
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.
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.
I guess what I was missing in my all attempts is e.Handled = true;
Anyways thanks again !