Hi,
so i have been changing everything so that it fits into mvvm model. So i have bound my document by using the xamldataprovider and that works fine. But now, when when i use functions such as gotobookmark or try and highlight the text it no longer works.
I call:
Document.GoToBookMark(bookmarkrange);
I then attempt to update by calling:
public void UpdateXaml()
{
var xamlProvider = new XamlDataProvider { Xaml = XamlText, RichTextBox = RichTextBox };
xamlProvider.UpdateDocument();
}
but nothing seems to happen. Is this the correct way to update? It is very slow!
I have also been looking at your searchandhighlight project, this gives an example of how to change the text color using:
private void buttonClearHighlight_Click()
{
foreach (Block block in this.radRichTextBox.Document.Sections.First.Blocks)
{
foreach (Span span in block.Children)
{
if (span.HighlightColor == Colors.LightGray)
{
span.HighlightColor = Colors.Transparent;
}
}
}
this.radRichTextBox.UpdateEditorLayout();
}
This throws lots of exception when I tried to use it.
Unable to cast object of type 'Telerik.Windows.Documents.Model.BookmarkRangeStart' to type 'Telerik.Windows.Documents.Model.Span'.
Help on these issue would be much appreciated.
so i have been changing everything so that it fits into mvvm model. So i have bound my document by using the xamldataprovider and that works fine. But now, when when i use functions such as gotobookmark or try and highlight the text it no longer works.
I call:
Document.GoToBookMark(bookmarkrange);
I then attempt to update by calling:
public void UpdateXaml()
{
var xamlProvider = new XamlDataProvider { Xaml = XamlText, RichTextBox = RichTextBox };
xamlProvider.UpdateDocument();
}
but nothing seems to happen. Is this the correct way to update? It is very slow!
I have also been looking at your searchandhighlight project, this gives an example of how to change the text color using:
private void buttonClearHighlight_Click()
{
foreach (Block block in this.radRichTextBox.Document.Sections.First.Blocks)
{
foreach (Span span in block.Children)
{
if (span.HighlightColor == Colors.LightGray)
{
span.HighlightColor = Colors.Transparent;
}
}
}
this.radRichTextBox.UpdateEditorLayout();
}
This throws lots of exception when I tried to use it.
Unable to cast object of type 'Telerik.Windows.Documents.Model.BookmarkRangeStart' to type 'Telerik.Windows.Documents.Model.Span'.
Help on these issue would be much appreciated.