index > Windows Presentation Foundation ("Avalon") > How to go to first page with a FlowDocumentReader control?

How to go to first page with a FlowDocumentReader control?

Hi,

I actually test WPF RC1:

I use a FlowDocumentReader. This control have not "FirstPage()" method (DocumentViewerBase has it). So, how can I go to first page with a FlowDocumentReader control?

Thanks very much.
Cyber Sinh
Cyber Sinh
Q1>

((IDocumentPaginatorSource)RTB.Document).DocumentPaginator.GetPage(0)

havent tried this... but should work..

lester - MSFT
Hello,

I'm sorry but your method has no effect. Is it a bug with the RC1 of Avalon ?

Thanks
Cyber Sinh

fdr.Document.Blocks.FirstBlock.BringIntoView(); // this brings focus to the first page.

lester - MSFT

With this code, the method "FirstBlock.BringIntoView()" has again no effect.

StringReader sr = new StringReader(song.Lyrics);

txtLyrics.Inlines.Clear();

string line = null;

while ((line = sr.ReadLine()) != null)

{

txtLyrics.Inlines.Add(line);

txtLyrics.Inlines.Add(new LineBreak());

}

//((IDocumentPaginatorSource)docLyrics).DocumentPaginator.GetPage(0); // no effect

docLyrics.Blocks.FirstBlock.BringIntoView(); // no effect --> the FlowDocumentReader remains on the current page (before change)

Thanks

Cyber Sinh

Get page gets the paginated page - it doesnt bring the page into focus. I thought you wanted to obtain the page.

Bringintoview should work... However since you are adding to a single para it would be necessary to bring the first inline into view. Also, there is no delay between adding the lines and calling the first line into focus..

as such you could you a delegate as below adn that should work

this.application.Dispatcher.BeginInvoke(DispatcherPriority.ApplicationIdle, new SimpleHandler(Focus));

lester - MSFT
reply 6

You can use google to search for other answers

 

More Articles

• Resize Elements inside the canvas
• XamlParseExeption using ZAM 3D object
• XamlParseException Line1 Postion 9????
• Using web services with xbap application
• What is "best practise" for databinding custom controls...
• Outlook Bar like control in WPF
• Override properties set manualy with resourcedictionary.
• Custom Popup Placement in control template
• Triggers and MultTriggers problems
• Dynamicly changing the staticresource to use on a control.
Bookmark and Share
Welcome to Bokebb   New Update  
 

New Articles

• Updated samples for RC1
• stupid question: how to use the "co
• XAML RSS Reader problem
• How can I move and resize window without
• Cannot set Name attribute value 'Tab1' o
• RoutedEvent weirdness
• XBAP application not picking relative path
• MarkupExtension to Connect WPF to CAB Se
• FlowDocumentScrollViewer, horizontal scr
• DataBinding vs Static classes
• Activated event raised on minimize
• send mail code for yahoo account to redi
• Xaml Navigation Pane Control
• .NET 3.0 and Expression Interactive Desi
• XAML Namespace Mapping

Hot Articles

• WPF application template....
• Outlook Bar like control in WPF
• Cannot re-initialize ResourceDictionary
• VS2005 pretty unstable with the Orcas CT
• Window.LayoutTransform -> Why doesn't
• Add button with dropdown include menu wi
• Issue with WPF Designer in Vista Build 5
• Dynamic Gridview columns Update
• WPF Architectural Question
• Creating a RoutedEvent using reflection
• How do I access child ui elements of a L
• Data binding: bind DrawingBrush to Recta
• WPF observable Collection
• ITypedList not supported in data binding?
• EMF or WMF export

Recommend Articles

• culture of IValueConverter.Convert method
• Syntax for Binding Attached Properties
• Executing Commands from *any* event
• TextBlock Style in a Grid
• Raising an event when a Storyboard hits
• Creating a Hyperlink with Databound text
• How to get DependencyProperty by its name?
• HOw to add textbox columns in Datagrid v
• Sylin' a Panel's Navigation UI
• Control Rendering Space For a Line
• binding a BitmapSource to a FormatConver
• how do i reinstall component MSACM32.dll
• browser app questions
• Render buttons without border
• How to drag/drop custom control in grid.