John Papa
ASPSOFT, inc.
www.aspsoft.com
john@johnpapa.net
www.johnpapa.net
INETA
The Face of .NET
● World-wide association of .NET User Groups
– 860+ groups world-wide
– Over 810,000 developers
● Started and run by .NET User Group leaders
● Sponsors and supports both .NET and other
professional user groups all around the world
● Sponsors
– Microsoft
– Verio
– New sponsors welcome!
● North America (NorAm) INETA Speaker Bureau
consists of 67 world-renowned speakers
www.ineta.org
20,000 Foot View
● What is in Silverlight 2 ?
● XAML based data binding
● Notifications
● Converters
● Data Services
– Self Describing
– Nimble
What’s New And Notable?
● Framework Languages and .NET Support
● Isolated Storage
● Non Contractual Data Services: JSON, REST,
SOAP/WS-*, POX, and RSS Web Services
● Cross Domain Network Access
● LINQ to Objects and LINQ to XML
● StackPanel, Grid and Panel Layout Support
● Full suite of Controls
● Deep Zoom Technology
4 Flavors of LINQ
● LINQ to Objects
– Use and abuse on the Silverlight client with any
type of object collection
● LINQ to XML
– Use and abuse on the client to consume XML
from a variety of data services
● Server based business rules
– LINQ to SQL
– LINQ to Entities
Manual Binding
● Push and Pull
– Pull a value from a data source property into a
control
– Push a value from a control to a data source
property
● Repetitive code
● Manual process
● Can write a binding class to handle it
Where to Bind ?
● Type XAML in Visual Studio
● Type .NET code in Visual Studio
● Type XAML in Expression Blend
● Use Expression blend Designer
XAML Binding
● Automated binding
● Bind a FrameworkElement to a data source
● Dependency Property
● DataContext
● Binding Modes
● Rule #1
– The target of data binding must be a
FrameworkElement
Rule #1
● The target of data binding must be a
FrameworkElement
Rule #2
● The target property of data binding
must be a Dependency Property
– data bound properties whose value is
determined at runtime
Dependency Property At Work
public static readonly
DependencyProperty FillProperty;
<someFrameworkElement
property="{Binding oneOrMoreBindingProperties}" .../>
<someFrameworkElement property
="{Binding pathvalue, oneOrMoreBindingProperties}" .../>
Binding Extension Properties
● Converter
● ConverterCulture
● ConverterParameter
● Mode
● NotifyOnValidationError
● Path
● Source
● ValidatesOnExceptions
RunTime Binding
● FrameworkElement.SetBinding method
– Sets the binding
firstNameBinding.Source = person;
tbFirstName.SetBinding(
TextBox.TextProperty,
firstNameBinding);
DataContext is the Binding Hub
DataContext
● Mystical and magical data source? No.
● Allows you to set a data source for a
specific context
– In other words you can …
● Have different data sources for different target
controls
● Inherit data sources
● Supports 1 way, 1 time, and 2 way bindings
Binding Modes
OneTime OneWay TwoWay
Target is Updated Yes Yes Yes
When DataContext is
Set
● Easy to implement
– keep it clean
ObservableCollection<T>
● Lists listen to ObservableCollection<T> for
changes
● Implements INotifyPropertyChanged
● Implements INotifyCollectionChanged
– Notifies when list contents change
Converters
● Can convert values to and from
● IValueConverter interface
– ConvertTo
– ConvertBack
Consuming Data Services
Silverlight Data Services
● Services that describe themselves
– SOAP
– WCF with contracts
● Conversion to ObservableCollection<T>
● http://johnpapa.net
● john@johnpapa.net