Developer's Guide to Microsoft Prism Library 5.0 for WPF Microsoft patterns & practices April 2014 2 Copyright This document is provided “as-is”. Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred. This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes. You may modify this document for your internal, reference purposes. © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Server, Windows Vista, Silverlight, Expression Blend, MSDN, IntelliSense, Visual C#, Visual C++, and Visual Studio are trademarks of the Microsoft group of companies. All other trademarks are property of their respective owners. 3 Contents Download and Setup Prism ........................................................................................................................... 8 Documentation ......................................................................................................................................... 8 NuGet Packages ........................................................................................................................................ 8 Download and Setup the Prism Source Code ........................................................................................... 9 Adding Prism Library Source Projects to Solutions ................................................................................. 13 Related Downloads ................................................................................................................................. 13 What's New in Prism Library 5.0 for WPF ................................................................................................... 14 New Guidance ......................................................................................................................................... 14 Changes in the Prism Library................................................................................................................... 14 CodePlex Issues Resolved ....................................................................................................................... 16 Example Code Changes ........................................................................................................................... 17 NuGet Packages Now Available .............................................................................................................. 18 The Team Who Brought You This Guide ..................................................................................................... 19 1: Introduction ............................................................................................................................................ 20 Why Use Prism? ...................................................................................................................................... 20 Prerequisites ........................................................................................................................................... 23 An Overview of Prism .............................................................................................................................. 24 2: Initializing Applications ........................................................................................................................... 37 What Is a Bootstrapper? ......................................................................................................................... 37 Key Decisions .......................................................................................................................................... 38 Core Scenarios ........................................................................................................................................ 38 3: Managing Dependencies Between Components .................................................................................... 45 Key Decision: Choosing a Dependency Injection Container ................................................................... 46 Core Scenarios ........................................................................................................................................ 47 Using Dependency Injection Containers and Services in Prism .............................................................. 51 IServiceLocator ........................................................................................................................................ 52 Considerations for Using IServiceLocator ............................................................................................... 54 4: Modular Application Development ........................................................................................................ 55 Benefits of Building Modular Applications ............................................................................................. 55 4 Core Concepts ......................................................................................................................................... 56 Key Decisions .......................................................................................................................................... 60 Core Scenarios ........................................................................................................................................ 65 5: Implementing the MVVM Pattern .......................................................................................................... 77 Class Responsibilities and Characteristics ............................................................................................... 77 Class Interactions .................................................................................................................................... 82 Construction and Wire-Up ...................................................................................................................... 93 Key Decisions .......................................................................................................................................... 96 6: Advanced MVVM Scenarios .................................................................................................................... 98 Commands .............................................................................................................................................. 98 Interaction Triggers and Commands ..................................................................................................... 104 Handling Asynchronous Interactions .................................................................................................... 106 User Interaction Patterns ...................................................................................................................... 108 Advanced Construction and Wire-Up ................................................................................................... 114 Testing MVVM Applications .................................................................................................................. 117 7: Composing the User Interface .............................................................................................................. 123 UI Layout Concepts ............................................................................................................................... 124 UI Layout Scenarios ............................................................................................................................... 133 UI Design Guidance ............................................................................................................................... 150 UI Layout Key Decisions ........................................................................................................................ 165 8: Navigation ............................................................................................................................................. 167 Navigation in Prism ............................................................................................................................... 167 9: Communicating Between Loosely Coupled Components ..................................................................... 190 Solution Commanding ........................................................................................................................... 190 Region Context ...................................................................................................................................... 193 Shared Services ..................................................................................................................................... 194 Event Aggregation ................................................................................................................................. 195 10: Deploying Applications ....................................................................................................................... 202 Deploying WPF Prism Applications ....................................................................................................... 202 11: Glossary ..............................................................................................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages382 Page
-
File Size-