D2 SIG Meeting – 07/07/2009 – Recap
I attended the July D2 SIG Meeting this passed Tuesday. Claudio Lassala was speaking on the topic of Data Binding in WPF. Pretty good turnout of 30-35 people, especially since this is a fairly new group.
Claudio’s Information
- Blog: http://ClaudioLassala.spaces.live.com
- Email: Claudio@eps-software.com
- Twitter: http://Twitter.com/claudiolassala
High-level Presentation Summary
WPF – Windows Presentation Foundation – WikiPedia defines a WPF as graphical subsystem for rendering user interfaces in Windows-based applications.
XAML – Extensible Application Markup Language – The declarative language behind WPF
The simple concept of data binding is relating two objects and saying when one changes, so does the other.
Objects involved in Data Binding
- Target – TextBox, ComboBox,etc
- Source – Customer object
Binding Modes in WPF
- OneWay – reads the information from the source and populates the target TextBox.
- TwoWay – reads the information from the source and populates the target TextBox, but if the TextBox is changed, it updates the source Customer Object. This needs notification through a DependencyObject or INotifyPropertyChanged.
- OneWayToSource – sends data from the target to the source.
Types of Binding
- XAML Binding
- Programmatic Binding
Bindings can be removed using BindingOperations.ClearBinding() method
Relative Sources
- Self, TemplatedParent, FindAncestor, PreviousData
- Value Converters can convert values during the process of binding.
- Data Validation
- Data Templates
Some of the examples Claudio went over included
- Binding an image control to a byte array
- ListBox
- Validation Rules
- Simple Binding from Blend
- TwoWay Notification
- Rating to Color Converter
- XML Data Provider
Presentation Slides and Demo Code
Claudio does a great job of showing you how you should not code something then following by how you should.
–
Until next time…















