an introduction to silverlight gergely orosz @gergelyorosz
Post on 18-Dec-2015
218 views
TRANSCRIPT
![Page 1: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/1.jpg)
An Introduction To Silverlight
Gergely Orosz
http://GregDoesIT.com
@gergelyorosz
![Page 2: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/2.jpg)
In this presentation
What SL is capable of
How it is different
Learning curve overview
Why use SL
Non-traditional way
![Page 3: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/3.jpg)
What is Silverlight?
Rich Internet Application (RIA) platform
Capabilities are similar to Flash Java FX
Web-based subset of WPF
![Page 4: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/4.jpg)
Flash vs Silverlight
Flash Silverlight
Animation model Frame-based Time-based
Language ActionScript CLR-compilant (VB.NET, C#)
Platform All major Limited Linux (Moonlight)
Multithreading No (from programmer perspective)
Yes
![Page 5: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/5.jpg)
Flash vs Silverlight
Flash Silverlight
Image support Most formats JPG and PNG
Video, audio Multiple formats, low-level APIs
VC-1 codec, WMW, WM, no low-level APIs
Streaming More cost-effective
Other More mature Deep Zoom
![Page 6: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/6.jpg)
Flash vs Silverlight
Features: almost identical
Development environments
Streaming
Mobile: ?
![Page 7: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/7.jpg)
WPF
Descendant of Windows Forms
Built on .NET 3.5
XAML: descriptive markup language
![Page 8: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/8.jpg)
WPF / Silverlight features
Vector graphics & bitmap effects
Data binding & UI update
Animations
Rich content: videos, images, sounds
Styling, templates
![Page 9: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/9.jpg)
Silverlight: lightweight WPF
CLR within Browser
Limited CLR: Not all libraries Local filesystem limited Networking limited
![Page 10: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/10.jpg)
XAML
Separate UI and logic
XML markup, clean syntax
XAML and code behind files
Does not support generics
![Page 11: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/11.jpg)
XAML: a simple example
Code
![Page 12: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/12.jpg)
UI Basics
Layout Grid, Canvas, StackPanel
Controls Button, HyperLinkButton, ComboBox etc
Text, images TextBlock, Image, MediaElement
Brushes Solid, linear, radial, image, video
User Controls
![Page 13: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/13.jpg)
UI Basics: Example
VideoBrush Example
Use MSDN/references to look up UI elements
![Page 14: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/14.jpg)
Styling and templating
Defining styles: TargetType Setters that are valid on the target
Templates Customize controls Uses ControlTemplate class
Easy to define in XAML
![Page 15: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/15.jpg)
Styling and templating: example
Code
![Page 16: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/16.jpg)
Dependency Properties
Extend CLR properties Property changed notification Data Binding Animating Default value and ClearValue
Has to inherit DependencyObject
![Page 17: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/17.jpg)
Dependency Properties: example
Registering, default value, Property Changed
Animating
Data Binding
![Page 18: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/18.jpg)
Attached Properties
Global property that can be set on any object element
Static Dps
Used by the owner, defined on the child
E.g. Canvas.Left, Grid.Column
![Page 19: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/19.jpg)
Attached properties: example
Code
![Page 20: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/20.jpg)
MVVM
How to effectively build large applications in WPF
Lots of UI markup, lots of data binding
Variation of MVC
![Page 21: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/21.jpg)
MVVM
Model BL, UI independent
View Visual elements + input processing
Data binding View and model can be bound directly Usually direct binding is not possible
![Page 22: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/22.jpg)
MVVM
ViewModel “Model of a View” Abstraction of the view: contains state and
behaviour Data binder/converter:
Model information → View information View commands → Model
![Page 23: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/23.jpg)
MVVM: Example
![Page 24: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/24.jpg)
MVVM in Silverlight
Worth using on larger projects Frameworks
MEF Official
Prism Non-official, but MS
![Page 25: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/25.jpg)
Summary
Similar to WPF XAML Styling & templating DPs Attached properties MVVM for larger applications
![Page 26: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/26.jpg)
Effort learning SL
Project structure: small
UI: significant
Media: moderate
Data binding: moderate
![Page 27: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/27.jpg)
Effort learning SL
Network: moderate
Events: moderate
Other: moderate - significant Dependency Properties, Attached Properties MVVM Navigation Framework Out of Browser applications
![Page 28: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/28.jpg)
Why It's Worth It
Things you couldn't do before!
Good looking controls & pages
Animation
Video & vector graphics
![Page 29: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/29.jpg)
Why It's Worth It
Silverlight client for Facebook
Silverlight Toolkit (with source)
http://www.jumpman23mosaic.com http://silverlight.net/showcase/ http://nokola.com/ (with source)
![Page 30: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/30.jpg)
Suggested Learning Curve
C# / VB experience
Web http://silverlight.net/getstarted/ MSDN: Getting Started with Silverlight
Books
WPF
![Page 31: An Introduction To Silverlight Gergely Orosz @gergelyorosz](https://reader035.vdocuments.us/reader035/viewer/2022062421/56649d225503460f949f8f26/html5/thumbnails/31.jpg)
Thank You