
Joe Buckle
Top achievements
Rank 1
Joe Buckle
asked on 05 Jun 2011, 01:21 PM
Good day,
I'm trying to get all the bookmarks in a RadDocument, but GetAllBookmarks() returns an empty list. But when I try to set
I'm trying to get all the bookmarks in a RadDocument, but GetAllBookmarks() returns an empty list. But when I try to set
RadRichTextBox.Document.ShowBookmarks to true, the bookmarks are there. Why is this so?
Thank you very much.
3 Answers, 1 is accepted
0
Hello Joe Buckle,
In order to get all Bookmarks, the document has to be measured and arranged. If you are invoking the GetAllBookmarks method before showing the document in a RadRichTextBox in the visual tree, the list will be empty. When the document is shown on screen, it is automatically measured and arranged, but if you would like to get all bookmarks before that, you have two options:
Greetings,
Iva
the Telerik team
In order to get all Bookmarks, the document has to be measured and arranged. If you are invoking the GetAllBookmarks method before showing the document in a RadRichTextBox in the visual tree, the list will be empty. When the document is shown on screen, it is automatically measured and arranged, but if you would like to get all bookmarks before that, you have two options:
- Measure and arrange the document explicitly:
private
IEnumerable<BookmarkRangeStart> GetAllBookmarks(RadDocument document)
{
document.Measure(RadDocument.MAX_DOCUMENT_SIZE);
document.Arrange(
new
RectangleF(PointF.Empty, document.DesiredSize));
return
document.GetAllBookmarks();
}
- Use another method to get the bookmarks, which doesn't require a measured document, but is slower:
private
IEnumerable<BookmarkRangeStart> GetAllBookmarks(RadDocument document)
{
return
document.EnumerateChildrenOfType<BookmarkRangeStart>();
}
Greetings,
Iva
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Joe Buckle
Top achievements
Rank 1
answered on 06 Jun 2011, 01:13 PM
Thank you very much. But how do I set the content of the bookmark for each option?
0
Hi Joe Buckle,
I am not quite sure I understand your question. Can you elaborate a little on your scenario, for example:
All the best,
Iva
the Telerik team
I am not quite sure I understand your question. Can you elaborate a little on your scenario, for example:
- Do you want to delete the bookmark and insert text in its place?
- Should the bookmarks be deleted, or you still wish to be able to navigate to them?
- Are you doing this before showing the document in the editor or after it is loaded?
All the best,
Iva
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items