building Windows Phone applications with Silverlight, part 2
Basics of Silverlight 2
Click here to load reader
-
Upload
meenakshi-kumar -
Category
Technology
-
view
84 -
download
2
Transcript of Basics of Silverlight 2
![Page 1: Basics of Silverlight 2](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/1.jpg)
The Basics - II
![Page 2: Basics of Silverlight 2](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/2.jpg)
Silverlight and JS DemoMVVMBindingChange Notification
• INotifyPropertyChanged
• Dependency Properties
• ObservableCollection
XAMLSilverlight and Web ServicesRIA ServicesDemos
![Page 3: Basics of Silverlight 2](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/3.jpg)
![Page 4: Basics of Silverlight 2](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/4.jpg)
![Page 5: Basics of Silverlight 2](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/5.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/6.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/7.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/8.jpg)
INotifyPropertyChanged
![Page 9: Basics of Silverlight 2](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/9.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/10.jpg)
![Page 11: Basics of Silverlight 2](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/11.jpg)
![Page 12: Basics of Silverlight 2](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/12.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/13.jpg)
Demo
![Page 14: Basics of Silverlight 2](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/14.jpg)
Demo
![Page 15: Basics of Silverlight 2](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/15.jpg)
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](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/16.jpg)
Demo
![Page 17: Basics of Silverlight 2](https://reader038.fdocuments.us/reader038/viewer/2022100606/55a0f9851a28aba6398b46da/html5/thumbnails/17.jpg)