Click here to Skip to main content
15,889,892 members
Articles / Desktop Programming / XAML

Debugging XAML Binding with Silverlight 5

Rate me:
Please Sign up or sign in to vote.
4.11/5 (2 votes)
15 Apr 2011CPOL2 min read 10.5K   1  
Debugging XAML Binding with Silverlight 5

Well, hope that you were aware of Silverlight 5 Beta release announcement today and its latest feature, if not make sure to have a look at my earlier post here. In this post, we will discuss about XAML binding debugging, a new feature available in Silverlight 5. Be sure that you read my last line carefully - it's XAML Data Binding debugging, not XAML debugging.

For any data driven application with declarative data binding, within XAML, this brand new feature is significant in many ways. Personally, I remember most of the time I used to skip XAML way of binding as it lacked the 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

Make sure that you have downloaded the latest version of Silverlight Toolkit SDK. If not, download it from here. Also, make sure that you are running on Visual Studio SP1.

The XAML Data Binding

The example demonstrated here implements basic XAML data binding with DomainDataSource control, let's look at the XAML binding of one of the controls.

Silverlight5 XAML Debugging - Click to enlarge image

Nothing fancy, simple binding.

The XAML Debugging

Setting Up Breakpoint

As of now, the XAML allows to apply breakpoint on Binding syntax only. Once the break point is applied, it hits the breakpoint whenever push and pull is triggered for that control. The image below shows the breakpoint within XAML.

Silverlight5 XAML Debugging - Click to enlarge image

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

The Debug Information

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

Silverlight5 XAML Debugging - Click to enlarge image

You can find the debug information from Local tab.

Silverlight5 XAML Debugging - Click to enlarge image

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

Silverlight5 XAML Debugging

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

Silverlight5 XAML Debugging - Click to enlarge image

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

Silverlight5 XAML Debugging

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.

image - Click to enlarge image

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

Silverlight5 XAML Debugging - Click to enlarge image

Conclusion

Hope this post helps you to know the cool new feature of Silverlight 5. Try it Thumbs up and extract information you need to know right from XAML.

Keep commenting and keep your suggestions flowing. More to follow on Silverlight 5 Beta new features as I explore Be right back.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Microsoft
India India
Nothing special .. I like challenges and love my critics.

Microsoft | Bangalore | India

Blog : http://manaspatnaik.com/blog

Twitter@manas_patnaik

Comments and Discussions

 
-- There are no messages in this forum --