Presentation is loading. Please wait.

Presentation is loading. Please wait.

2 3 4 6 8 9 10 11 12 15.

Similar presentations


Presentation on theme: "2 3 4 6 8 9 10 11 12 15."— Presentation transcript:

1

2 2

3 3

4 4

5

6 6

7

8 8

9 9

10 10

11 11

12 12

13

14

15 15

16

17

18

19

20 What's MVVM? is an architectural pattern created by John Gossman from WPF team is a variation of MVC pattern is similar to Martin Fowler’s PresentationModel pattern WPF Data Binding & Commanding

21 Motivation and benefits Testabiltiy ( ViewModel is easier to unit test than code-behind or event driven code ) Clear seperation between UX designer and developer Increases the "Blendability" of your view Model never needs to be changed to support changes to the view ViewModel rarely needs to be changed to support changes to the view No duplicated code to update views

22 MVVM View knows ViewModel ViewModel knows Models But not vice versa.

23 View represents the user interface that the user will see. can be a user control or Data Template shouldn't contain any logic that you want to test Keep the view as simple as possible.

24 View Model An abstraction of View Connector between View and Model Keep View State, Value Conversion No strong or weak (via Interface) reference of View Make VM as testable as possible (e.g. no call to Singleton class) No Control related Stuff in VM

25 Model can be Data Model, DTO, POCO, auto- generated proxy of domain class and UI Model based on how you want to have the separation between Domain Service and Presentation Layer No reference to ViewModel

26 26

27

28 Hello World!

29 29 public class MyApp : Application { [STAThread] static void Main(string[] args) { MyApp app = new MyApp(); app.Startup += app.OnApplicationStartup; app.Run(args); } void OnApplicationStartup(object sender, StartupEventArgs e) { Window w = new Window(); w.Title = "Mark says: Hello World!"; w.Show(); } }

30

31 Just text Just text The next line

32 32 Top left Middle LRight

33 void innerButton_Click(object sender, RoutedEventArgs e) { MessageBox.Show("Hello SDN!"); e.Handled = true; }

34

35 Name: City: < >

36

37

38

39

40

41


Download ppt "2 3 4 6 8 9 10 11 12 15."

Similar presentations


Ads by Google