Debugging XAML Binding with Silverlight 5

I have been developing in Silverlight (SL) for a while and the biggest challenge has always been debugging the binding values in the XAML end. I came across this post which really explained how to go about it.

For any data driven application with declarative data binding, with in XAML ,this brand new feature is the significant in many ways. Personally I remember most of the time i used to skip XAML way of binding as it lacked debugging feature. Now with Silverlight 5 my previous approach will surely take a back seat and will allow me to consider both ways equally.

Prerequisites

Makes sure that you have downloaded latest version Silverlight Toolkit SDK. If not download from here. Also make sure that you are running on VisualStudio SP1.

The XAML Data binding

The example demonstrated here implement basic XAML data binding with DomainDataSource control, lets look at the XAML binding of one of the controls.

The XAML Debugging

Setting Up Breakpoint

As of now the XAML allows to apply breakpoint on Binding syntax only.Once break point applied ,it hits the breakpoint when ever push and pull triggered for that control.The image bellow shows the breakpoint with in XAML.

The XAML editor will not allow you to set breakpoint anywhere else other than Binding syntax.

The Debug Information

Once Breakpoint set start the application and wait for the compiler to hit it.

You can find the debug information from Local tab.

The information shows up a BindingState object holding complete binding context information of the control.as in above image , the BindingState value is UpdatingTarget so this way it shows that the binding is pushing data to control.

Going deeper into the debugging information it shows complete picture on the nature of data and binding.

Now another interesting fact , on TwoWay binding scenario once you change the data , for .e.g the FirstName control

the breakpoint again gets a hit as the binding source is getting updated .And the debug information shows the Binding state as Updating Source status.

and the CurrentItem Information shows up the editing item detail and its properties.

Comments

Popular posts from this blog

Decompiling Delphi - 3

Decompiling Delphi - 2

Artificial Intelligence, Oxymoron and Natural Intelligence