Prism for the Windows Runtime reference (Windows Store business apps using C#, XAML, and Prism)
Prism for the Windows Runtime provides two libraries that help developers create managed Windows Store apps. The libraries accelerate the development of Windows Store apps by using proven design patterns such as the Model-View-ViewModel (MVVM) pattern and the event aggregation pattern. The Microsoft.Practices.Prism.StoreApps library provides support for bootstrapping MVVM apps, state management, validation of user input, navigation, data binding, commands, flyouts, settings, and search. The Microsoft.Practices.Prism.PubSubEvents library allows communication between loosely coupled components in an app, thus helping to reduce dependencies between assemblies in a Microsoft Visual Studio solution.
After you download the code, see Getting started with AdventureWorks Shopper for instructions on how to compile and run the reference implementation, as well as understand the Visual Studio solution structure.
- About the classes and interfaces contained in the Microsoft.Practices.Prism.StoreApps library.
- About the classes and interfaces contained in the Microsoft.Practices.Prism.PubSubEvents library.
- Windows Runtime for Windows 8
- Extensible Application Markup Language (XAML)
Prism helps developers create managed Windows Store apps. It accelerates development by providing support for MVVM, loosely coupled communication, and the core services required in Windows Store apps. It is designed to help developers create apps that need to accomplish the following:
- Address the common Windows Store app development scenarios.
- Build apps composed of independent, yet cooperating, pieces.
- Separate the concerns of presentation, presentation logic, and model through support for Model-View-ViewModel (MVVM).
- Use an architectural infrastructure to produce a consistent and high quality app.
Both libraries in Prism ship as source, with the Microsoft.Practices.Prism.PubSubEvents library also shipping as a signed binary.
The Microsoft.Practices.Prism.StoreApps library is a class library that provides MVVM support with lifecycle management, and core services to a Windows Store app.
The following table lists the classes contained in the Microsoft.Practices.Prism.StoreApps library:
|AppManifestHelper||Loads the package manifest and allows you to retrieve the application id, and check if the app uses the Search contract. This class can be extended to retrieve other app manifest values that are not exposed by the API.|
|BindableBase||Implementation of the INotifyPropertyChanged interface, to simplify view model and model class property change notification.|
|BindableValidator||Validates entity property values against entity-defined validation rules and exposes, through an indexer, a collection of errors for properties that did not pass validation.|
|Constants||An internal class that contains constants used by the library.|
|DelegateCommand||An ICommand implementation whose delegates do not take any parameters for Execute() and CanExecute().|
|DelegateCommand<T>||An ICommand implementation whose delegates can be attached for Execute(T) and CanExecute(T).|
|DelegateCommandBase||The base ICommand implementation whose delegates can be attached for Execute(Object) and CanExecute(Object).|
|FlyoutService||A service class that implements the IFlyoutService interface to display flyouts that derive from the FlyoutView class.|
|FlyoutView||A base class for views that will be displayed as flyouts.|
|FrameFacadeAdapter||A facade and adapter class that implements the IFrameFacade interface to abstract the Frame object.|
|FrameNavigationService||A service class that implements the INavigationService interface to navigate through the pages of an app.|
|MvvmAppBase||Helps to bootstrap Windows Store apps that use the MVVM pattern, with services provided by the Microsoft.Practices.Prism.StoreApps library.|
|MvvmNavigatedEventArgs||Provides data for navigation methods and event handlers that cannot cancel a navigation request.|
|ResourceLoaderAdapter||An adapter class that implements the IResourceLoader interface to adapt the ResourceLoader object.|
|RestorableStateAttribute||Defines an attribute that indicates that any marked property will save its state on suspension, provided that the marked property is in an instance of a class that derives from the ViewModel class.|
|SearchPaneService||A service class that implements the ISearchPaneService interface to abstract the SearchPane object.|
|SearchQueryArguments||Abstracts the SearchPaneQuerySubmittedEventArgs and the SearchActivatedEventArgs objects in order to provide one event handler that handles the search activation events for both when the app is running and when it is not.|
|SessionStateService||A service class that implements the ISessionStateService interface to capture global session state in order to simplify process lifetime management for an app.|
|SettingsCharmActionItem||Defines an item that is used to populate the Settings pane. Each item has an associated Action that will be executed when the item is selected in the Settings pane.|
|StandardFlyoutSize||A static class that defines the widths of narrow and wide flyouts.|
|ValidatableBindableBase||Implements the IValidatableBindableBase interface to validate model property values against their validation rules and return any validation errors.|
|ViewModel||The base view model class that implements the INavigationAware interface to provide navigation support and state management to derived view model classes.|
|ViewModelLocator||Locates the view model class for views that have the AutoWireViewModel attached property set to true.|
|VisualStateAwarePage||The base view class for pages that need to be aware of layout changes and update their visual state accordingly.|
The following table lists the interfaces contained in the Microsoft.Practices.Prism.StoreApps library:
|ICredentialStore||Defines an interface for the RoamingCredentialStore class that abstracts the PasswordVault object for managing user credentials.|
|IFlyoutService||Defines an interface that can be used to implement a service for displaying flyouts.|
|IFlyoutViewModel||Defines an interface that should be implemented by flyout view model classes to provide actions for opening and closing a flyout, and navigation away from the flyout.|
|IFrameFacade||Defines an interface for the FrameFacadeAdapter class that abstracts the Frame object for use by apps that derive from the MvvmAppBase class.|
|INavigationAware||Defines an interface that allows an implementing class to participate in a navigation operation.|
|INavigationService||Defines an interface that allows an implementing class to create a navigation service.|
|IResourceLoader||Defines an interface for the ResourceLoaderAdapter class that abstracts the ResourceLoader object for use by apps that derive from the MvvmAppBase class.|
|ISearchPaneService||Defines an interface for the SearchPaneService class that abstracts the SearchPane object for use by apps that derive from the MvvmAppBase class.|
|ISessionStateService||Defines an interface that allows an implementing class to capture global session state.|
|IValidatableBindableBase||Defines an interface that allows an implementing class to add validation support to model classes that contain validation rules.|
For info about how this library was used in the AdventureWorks Shopper reference implementation, see Using the Model-View-ViewModel (MVVM) pattern, Creating and navigating between pages, Validating user input, Managing application data, Handling suspend, resume, and activation, Communicating between loosely coupled components, and Implementing search.
The Microsoft.Practices.Prism.PubSubEvents library is a Portable Class Library (PCL) that contains classes that implement event aggregation. You can use this library for communicating between loosely coupled components in your own app. The library has no dependencies on other libraries, and can be added to your Visual Studio solution without the Microsoft.Practices.Prism.StoreApps library. The PCL targets:
- Microsoft .NET for Windows Store apps
- .NET Framework 4 and higher
- Microsoft Silverlight 4 and higher
- Windows Phone 7 and higher
- Xbox 360
For more info about portal class libraries, see Cross-Platform Development with the .NET Framework
The following table lists the classes contained in the Microsoft.Practices.Prism.PubSubEvents library:
|BackgroundEventSubscription<TPayload>||Extends EventSubscription<TPayload> to invoke the Action delegate in a background thread.|
|DataEventArgs<TData>||Generic arguments class to pass to event handlers that need to receive data.|
|DelegateReference||Represents a reference to a Delegate that may contain a WeakReference to the target. This class is used internally.|
|DispatcherEventSubscription<TPayload>||Extends EventSubscription<TPayload> to invoke the Action delegate in a specific Dispatcher.|
|EventBase||Defines a base class to publish and subscribe to events.|
|EventSubscription<TPayload>||Provides a way to retrieve a Delegate to execute an action depending on the value of a second filter predicate that returns true if the action should execute.|
|PubSubEvent<TPayload>||Defines a class that manages publication and subscription to events.|
|SubscriptionToken||Subscription token returned from EventBase on subscribe.|
The following table lists the interfaces contained in the Microsoft.Practices.Prism.PubSubEvents library:
|IDelegateReference||Represents a reference to a Delegate.|
|IEventAggregator||Defines an interface to get instances of an event type.|
|IEventSubscription||Defines a contract for an event subscription to be used by EventBase.|
The following table lists the enumerations contained in the Microsoft.Practices.Prism.PubSubEvents library:
|ThreadOption||Specifies on which thread a PubSubEvent<TPayload> subscriber will be called.|
Build date: 10/12/2013