Basics of Silverlight 2

17

Click here to load reader

Transcript of Basics of Silverlight 2

Page 1: Basics of Silverlight 2

The Basics - II

Page 2: Basics of Silverlight 2

Silverlight and JS DemoMVVMBindingChange Notification

• INotifyPropertyChanged

• Dependency Properties

• ObservableCollection

XAMLSilverlight and Web ServicesRIA ServicesDemos

Page 3: Basics of Silverlight 2
Page 4: Basics of Silverlight 2
Page 5: Basics of Silverlight 2

Model – Domain Object• Actual Data

• Holds information, not behavior or services that

manipulate the information

View Model – converter between View and

Model

View – Presentation

Page 6: Basics of Silverlight 2

Separation between View and ViewModel

Test driven development

Better data binding - two way data-binding

possible

ViewModel can aggregate parts of model

present in separate classes

Page 7: Basics of Silverlight 2

One Way• GUI element is updated whenever the object to

which element is bound is updated

Two Way• GUI element is updated whenever the object to

which element is bound is updated. Also, object is

updated whenever GUI changes.

One Time• The object to which the UI element is bound can

change the value of GUI element only once.

Page 8: Basics of Silverlight 2

INotifyPropertyChanged

Page 9: Basics of Silverlight 2

Dependency Properties

Button 1

Button 2

Button 3

Grid.Column = 0

Shared Default Value

Grid.Column = 1Button 4

Instance Specific Value

Page 10: Basics of Silverlight 2
Page 11: Basics of Silverlight 2
Page 12: Basics of Silverlight 2

Separating Design from Development

Portability between Web and Windows• Logical Tree – XAML as is

• Visual Tree – representation of actual code

Every element of visual tree is a dependency property

Page 13: Basics of Silverlight 2

Demo

Page 14: Basics of Silverlight 2

Demo

Page 15: Basics of Silverlight 2

Simplifies development of N-tier RIA

No need to focus on service plumbing

Client is automatically updated with latest

logic every time the solution is re-compiled

Page 16: Basics of Silverlight 2

Demo

Page 17: Basics of Silverlight 2