In other languages

Namespaces

Variants

Views

Actions

Search

Contents

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

{{Abstract|This article explains how to debug data binding issues by inspecting the elements before they are due to be displayed by the control.}}

{{Abstract|This article explains how to debug data binding issues by inspecting the elements before they are due to be displayed by the control.}}

Line 31:

Line 31:

{{Tip|If the converter doesn't get called then this is a sign that the binding has failed earlier than expected, perhaps in the definition of the source property or an incorrect DataContext. If a wrong property name in the binding declaration is given a message in the debug output window of VS appears. }}

{{Tip|If the converter doesn't get called then this is a sign that the binding has failed earlier than expected, perhaps in the definition of the source property or an incorrect DataContext. If a wrong property name in the binding declaration is given a message in the debug output window of VS appears. }}

+

== Steps to do ==

== Steps to do ==

Line 67:

Line 68:

<code xml>

<code xml>

<phone:PhoneApplicationPage.Resources>

<phone:PhoneApplicationPage.Resources>

−

<local:DataBindingDebugConverter x:Key="DatabindingDebugConverter"/>

+

<local:DatabindingDebugConverter x:Key="DatabindingDebugConverter"/>

</phone:PhoneApplicationPage.Resources>

</phone:PhoneApplicationPage.Resources>

</code>

</code>

Latest revision as of 06:39, 28 June 2013

This article explains how to debug data binding issues by inspecting the elements before they are due to be displayed by the control.

Contents

Data binding allows you to link a data source defined in code to a UI description in XAML (target). While defining a binding is quite straightforward, if something goes wrong it is useful to be able to tell whether the problem is in your source data or in the binding definition.

The easiest way to do this is to create a custom value converter (IValueConverter), which will be called when the data from the binding source arrives - before it gets delivered to the control. By setting a breakpoint in the converter you can confirm that the source is sending the expected data and contains the correct properties.

Tip: If the converter doesn't get called then this is a sign that the binding has failed earlier than expected, perhaps in the definition of the source property or an incorrect DataContext. If a wrong property name in the binding declaration is given a message in the debug output window of VS appears.