This question is locked. New answers and comments are not allowed.
So while testing my code, I noticed that if I type a random string of characters into the text box, it wraps as it should, but if I type just white space it will continue on the same line indefinitely, until I type some non whitespace character, which then wraps to the other side. After doing so, I also loose all my default page margins. I replicated the issue in a small solution. It's below.
The Xaml
The C#
Is there anything I can do to prevent this? In my original program I've also had a problem with the text being shifted to the left past the boarder of the text box sometimes when I select all, but not always. I think this problem may be related, but I'm not sure and I wasn't able to replicate it so I'll keep trying there.
Thanks,
Michael
The Xaml
<UserControl x:Class="RichTextBoxTest.MainPage" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Documents" xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation" xmlns:dHTML="clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <UserControl.Resources> <!-- This is necessary for binding the RadRichTextBox to the MessageHtml Property. Do not remove, even if marked as never used.--> <dHTML:HtmlDataProvider x:Key="xamlDataProvider" RichTextBox="{Binding ElementName=_rrtbMessage}" SetupDocument="SetupMessage"/> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <Controls:RadRichTextBox x:Name="_rrtbMessage" HorizontalAlignment="Stretch" Margin="200,100,200,100" VerticalAlignment="Stretch" BorderThickness="1" Background="White" IsSelectionMiniToolBarEnabled="False" DocumentInheritsDefaultStyleSettings="True" FontSize="11" BorderBrush="Black" /> </Grid></UserControl>The C#
using System.Windows.Controls;using Telerik.Windows.Documents.FormatProviders;using Telerik.Windows.Documents.Layout;using Telerik.Windows.Documents.Model;namespace RichTextBoxTest{ public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } private void SetupMessage(object sender, SetupDocumentEventArgs e) { e.Document.LayoutMode = DocumentLayoutMode.Flow; e.Document.ParagraphDefaultSpacingAfter = 0; e.Document.SectionDefaultPageMargin = new Padding(5, 3, 3, 5); } }}Is there anything I can do to prevent this? In my original program I've also had a problem with the text being shifted to the left past the boarder of the text box sometimes when I select all, but not always. I think this problem may be related, but I'm not sure and I wasn't able to replicate it so I'll keep trying there.
Thanks,
Michael