Windows8

MVVM Light for Windows8

Using the MVVM Pattern in Windows 8 [MSDN Magazine]

http://msdn.microsoft.com/en-us/magazine/jj651572.aspx

Installing the MVVM Light v4

1. download and install mvvm light toolkit

2. read the readme file.

3. load the .VSIX file in the readme file or start>MVVM Light>VSIX Folder

Deep Dive MVVM (mix11 video)

http://channel9.msdn.com/Events/MIX/MIX11/OPN03 (video)

http://blog.galasoft.ch/archive/2011/04/13/deep-dive-mvvm-samples-mix11-deepdivemvvm.aspx (code) download the Zip file

How do you avoid redundancy?

How do you start animation?

How do you show Dialog?

How do you do navigation?

How do you handle multiple VMs?

How do you test your VMs?

How to start MVVM Light for Windows 8 app.

http://galasoft.ch/mvvm/installing/nuget/

1. nuget으로 mvvm light를 프로젝트에 설치하면

2. ViewModelLocator.cs

MainViewModel.cs 가 추가되어 있고, App.xaml 에 자동적으로 ViewModelLocator가 전역리소스로 추가되어져 있다.

다음 작업 부터는 해당 사이트에 자세히 서술되어 있다.

2012.08.09

현재 Nuget 버전에서는 변경된 Xaml의 네임스페이스를 import 하는 방식이 적용되어 있지 않으므로,

아래와 같이 수동으로 수정해주어야 한다.

Windows 8 has a new way to import CLR namespaces into XAML.

In order to avoid issues, after installing MVVM Light through Nuget in your Windows 8 Metro style application, follow these steps:

– open App.xaml

– Locate the statement xmlns:vm=”clr-namespace:[YouApplication].ViewModel”

– Replace this statement with: xmlns:vm=”using:[YouApplication].ViewModel”

Navigation using MVVMLight in windows8

*  Page navigation through ViewModel using MVVMLight in windows 8

1. implement the NavigationService with the INavigationService

2. inject _navigationService to ViewModel Constructor

3. use the _navigationService reference at the ViewModel

http://social.msdn.microsoft.com/Forums/en-AU/winappswithcsharp/thread/61b66a9a-3557-4b6b-ab47-50bb9d44f38b

1. define the static RootFame property in app.xaml.cs

2. [A] using NavigationService

http://geekswithblogs.net/lbugnion/archive/2011/01/06/navigation-in-a-wp7-application-with-mvvm-light.aspx

[A] http://dotnetbyexample.blogspot.kr/2012/06/navigationservice-for-winrt.html

(2012.08.09) 아직까지는 NavigationService 클래스가 기본 어셈블리에 포함되어 있지 않다. WindowsPhone7 에서는 INavigationService와 함께 제공이 되었는데, 아직 VisualStudio 2012 RC 버전이라 그런지 현재까지는 없다.

따라서 INavagionService 와 NavigationService를 개발자가 직접 구현하여, IoC등으로 등록해 사용해야 할 것이다.

* Binding ViewModel at view xaml (TwoWay로 ViewModel을 바인딩하려고 할때 유용할 것 같다. TwoWay 바인딩이 되는지는 테스트 해 보지 못함.)

<common:LayoutAwarePage.DataContext>
<Binding Mode=”OneWay” Path=”Main” Source=”{StaticResource Locator}”/>

or

<Binding Mode=”TwoWay” Path=”Main” Source=”{StaticResource Locator}”/>
</common:LayoutAwarePage.DataContext>

 

[A] Building a deployable custom control for XAML Metro style apps

Advertisements

One thought on “MVVM Light for Windows8

  1. Pingback: Windows Store App | BEST CSM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s