C# Class PushSample7_0.ViewModel.ViewModelLocator

This class contains static references to all the view models in the application and provides an entry point for the bindings.

Use the mvvmlocatorproperty snippet to add ViewModels to this locator.

In Silverlight and WPF, place the ViewModelLocatorTemplate in the App.xaml resources:

<Application.Resources> <vm:ViewModelLocatorTemplate xmlns:vm="clr-namespace:PushSample7_0.ViewModel" x:Key="Locator" /> </Application.Resources>

Then use:

DataContext="{Binding Source={StaticResource Locator}, Path=ViewModelName}"

You can also use Blend to do all this with the tool's support.

See http://www.galasoft.ch/mvvm/getstarted

In *WPF only* (and if databinding in Blend is not relevant), you can delete the Main property and bind to the ViewModelNameStatic property instead:

xmlns:vm="clr-namespace:PushSample7_0.ViewModel" DataContext="{Binding Source={x:Static vm:ViewModelLocatorTemplate.ViewModelNameStatic}}"
Afficher le fichier Open project: matthiasxc/Windows-Phone-7-Push-Notification-Sample-All

Private Properties

Свойство Type Description

Méthodes publiques

Méthode Description
Cleanup ( ) : void

Cleans up all the resources.

ClearMain ( ) : void

Provides a deterministic way to delete the Main property.

CreateMain ( ) : void

Provides a deterministic way to create the Main property.

ViewModelLocator ( )

Initializes a new instance of the ViewModelLocator class.

Method Details

Cleanup() public static méthode

Cleans up all the resources.
public static Cleanup ( ) : void
Résultat void

ClearMain() public static méthode

Provides a deterministic way to delete the Main property.
public static ClearMain ( ) : void
Résultat void

CreateMain() public static méthode

Provides a deterministic way to create the Main property.
public static CreateMain ( ) : void
Résultat void

ViewModelLocator() public méthode

Initializes a new instance of the ViewModelLocator class.
public ViewModelLocator ( )