410 likes | 710 Views
APP-914T. The lifetime of XAML text: from input to display through printing. Chipalo Street Program Manager Microsoft Corporation. Agenda. Overview of new features in XAML text controls Printing simplification in Windows 8 and XAML framework. You’ll leave with examples of how to
E N D
APP-914T The lifetime of XAML text: from input to display through printing Chipalo Street Program Manager Microsoft Corporation
Agenda • Overview of new features in XAML text controls • Printing simplification in Windows 8 and XAML framework • You’ll leave with examples ofhow to • Use new features available in XAML text controls • Integrate a XAML app with the printing charm
Familiar XAML text controls Editable • TextBox • PasswordBox Non editable • TextBlock
What’s new Touch text selection • includes context menus • selection on by default for all controls except TextBlock Soft keyboard integration • implicit invocation
What’s new IsSpellCheckEnabled • language specific for free • off by default on TextBox IsTextPredictionEnabled • language specific for free • only when using soft keyboard
What’s new Clear text button Standard leading model • LineStackingStrategy = “BaselineToBaseline”
What’s new Password reveal button • only reveals during hold
demo Designed for touch Great touch features are baked into default text controls Touch text selection Integration with the soft keyboard Spell checking Text prediction
RichTextBlock – new element • Richer text display than TextBlock • Designed for touch selection • Many of the same properties as TextBlock
RichTextBlockOverflow – new element XAML page RichTextBlock Today, at the D9 Conference, we demonstrated the next generation of Windows, internally code-named “Windows 8,” for the first time. Windows 8 is a reimagining of Windows, from the chip to the interface. A Windows 8-based PC is really a new kind of device, one that scales from touch-only small screens through to large screens, with or without a keyboard and mouse. The demo showed some of the ways we’ve reimagined the interface for a new generation of touch-centric hardware. Fast, fluid and dynamic, the experience … RichTextBlockOverflow interface for a new generation of touch-centric hardware. Fast, fluid and dynamic, the experience … OverflowContentTarget
RichTextBlock RichTextBlockOverflow RichTextBlockOverflow
Linked text containers • RichTextBlock starts a chain of linked text containers • RichTextBlockOverflow elements can be linked to the first RichTextBlock or another RichTextBlockOverflow element (with no limit) • Linked text containers need to be in the visual tree for layout RichTextBlock RichTextBlockOverflow RichTextBlockOverflow RichTextBlockOverflow …
RichTextBlockOverflow - attributes • Most controlled by RichTextBlock • OverflowContentTarget (also on RichTextBlock) • HasOverflowContent(also on RichTextBlock)
demo Differentiating your experience Linked text containers allow for creation of unique and engaging experiences while maintaining the Windows 8 touch experience
XAML printing Register for printing When: app startup Why: enable print charm by telling Windows your app can print
XAML printing Register for printing Printing initialization When: user invokes print charm Why: provide Windows with basic info about current print job
XAML printing Register for printing Printing initialization Paginate content When: printer settings are ready for preview pages to be created Why: ensure there are preview pages to show the user
XAML printing Register for printing Printing initialization Paginate content When: Windows asks for a specific preview page Why: user has requested to see a print preview page Provide preview page
XAML printing Register for printing Printing initialization Paginate content When: Windows asks app to create preview pages Why: user changed print settings Provide preview page
XAML printing Register for printing Printing initialization Paginate content When: Windows is ready to print Why: user requested printing to begin Provide final pages Provide preview page
XAML printing Register for printing Printing initialization Paginate content Provide final pages Provide preview page
Register for printing PrintManagerprintManager = PrintManager.GetForCurrentView(); • publicMainPage() • { • } // add a handler for printing initialization printManager.PrintTaskInitializing+= newTypedEventHandler<PrintManager, PrintTaskInitializingEventArgs>(InitializePrintTask); // let XAML help with printing _printDocument= newPrintDocument(); // add handler to create print preview pages _printDocument.Paginate += newPaginateEventHandler(CreatePreviewPages); // add a handler to provide a specific preview page _printDocument.GetPreviewPage += new GetPreviewPageEventHandler(GetPreviewPage); // add a handler to provide final print pages _printDocument.AddPages += newAddPagesEventHandler(AddPages); _docSource= _printDocument.DocumentSource; // save the DocumentSource
XAML printing Register for printing Printing initialization Paginate content Provide final pages Provide preview page
Printing initialization • voidInitializePrintTask(PrintManagersender, • PrintTaskInitializingEventArgsargs) • { • } // provide the doc source and print job name args.Request.InitializePrintTask(documentSource, "Printing Demo"); // do any printing initialization needed. for example, create a // cache for print preview pages. _printPreviewPages = newList<UIElement>();
XAML printing Register for printing Printing initialization Paginate content Provide final pages Provide preview page
Paginate content // create print preview pages how ever you see fit // while(!CreatedAllPreviewPages()) //{ // _printPreviewPages.Add(CreateOnePage()) ; //} • privatevoidCreatePreviewPages(objectsender, PaginateEventArgs e) • { • } // tell Windows how many print preview pages there are _printDocument.SetPreviewPageCount(_printPreviewPages.Count)
XAML printing Register for printing Printing initialization Paginate content Provide final pages Provide preview page
Provide preview page // give Windows the preview page that it requested _printDocument.SetPreviewPage(e.PageNumber, _printPreviewPages[e.PageNumber- 1]); • private void GetPreviewPage(object sender,GetPreviewPageEventArgse) • { • }
XAML printing Register for printing Printing initialization Paginate content Provide final pages Provide preview page
Create final print pages • // send the pages to Windows in order • for(int i = 0; i < _printPreviewPages.Count; i++) • { • _printDocument.AddPage(_printPreviewPages[i]) ; • } • private void AddPages(object sender,AddPagesEventArgse) • { • } • // tell Windows you are done giving it pages to print • _printDocument.AddPagesComplete();
demo From digital to physical Use the devices charm to print a Metro style app built with the XAML framework
A lot of great features have been added to the XAML text stack.
All text controls have been improved to make touch a first class experience for developers and end users.
Printing your app through the unified Windows 8 printing experience is simple.
Related sessions • [PLAT-679T] Building Metro style apps that print • [APP-211T] Create Metro style apps quickly with built-in controls • [APP-737T] Metro style apps using XAML: what you need to know • [APP-515] Tips and tricks for developing Metro style apps using XAML
For more information • Metro style app sample page http://go.microsoft.com/fwlink/?LinkId=221708 • Windows 8 blog http://blogs.msdn.com/b/b8/
thank you Feedback and questions http://forums.dev.windows.com Session feedbackhttp://bldw.in/SessionFeedback
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.