Silverlight 2 Binding Modes Diagram
Here’s a tiny little nugget from my upcoming book. There are always concepts that are just natively drilled into me yet they don’t flow smoothly when I try to explain them. For example take the Silverlight 2 binding modes. You have OneTime, OneWay and TwoWay as options. OneWay is the default and many examples of XAML based binding I see of XAML in both Silverlight and WPF omit the Mode property entirely. But OneTime is not always the appropriate option, either. Read only data is better suited for OneWay while editable data is suited well for TwoWay. Data that should only be bound and displayed when the source is first bound is ideal for OneTime.
There are nuisances to the scenarios, too (aren’t there always?). For example, OneWay and TwoWay bindings rely on the INotifyPropertyChanged interface and its PropertyChanged event being raised.
OK, so my point is that sometimes explaining these types of situations is more difficult than just showing them with code. I;ve always been more about show me the code and sprinkle a little bit of explanation around it. To me that is so much easier to comprehend than reading a dozens of pages without code or pictures.
So I came up with a simple diagram for to help myself explain the binding modes a little bit. Its not the only tool I use (I use code samples, other diagrams, and words too) but its one I start with. I figured I would share it for any who might be interested. You can also find a variation of this diagram in my upcoming book Data Access with Silverlight 2 published by O’Reilly (Dec 2008).