Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I debug Windows Runtime data bindings?

What techniques are there for debugging issues with data binding in a Windows Metro style application? Are there techniques available like those for WPF and Silverlight applications, described at:

  • How can I debug WPF bindings?
  • Debugging Data Bindings in a WPF or Silverlight Application
  • How can I turn binding errors into runtime exceptions?

EDIT: I was originally asking about WinRT data binding debugging techniques so that I could troubleshoot the issue described at Metro: Why is binding from XAML to a property defined in code-behind not working?. I eventually found a solution to this issue, but experimenting with the working solution, I did not see any message in the Visual Studio 11 output window when I purposely misspelled the property name so that it would not be found. It also does not appear that PresentationTraceSources is available to WinRT apps.

like image 741
Daniel Trebbien Avatar asked Dec 26 '11 22:12

Daniel Trebbien


People also ask

How do I debug XAML?

Navigate to Tools –> Options –> Debugging –> General –> Enable UI Debugging Tools for XAML . In case you are not able to inspect you xaml and not able to see it in Live property explorer you need to check it. With the option selected, the both xaml inspection and live visual tree work seamlessly for any xaml debugging.

How do I debug WPF application in Visual Studio?

You can use the Live Visual Tree to explore the visual tree of a WPF object and view the WPF dependency properties for the objects in that tree. You can use the WPF Tree Visualizer to explore the visual tree of a WPF object and view the WPF dependency properties for the objects in that tree.

How do I enable Debugging in Visual Studio?

In the Visual Studio toolbar, make sure the configuration is set to Debug. To start debugging, select the profile name in the toolbar, such as <project profile name>, IIS Express, or <IIS profile name> in the toolbar, select Start Debugging from the Debug menu, or press F5.


1 Answers

Another possible solution:

sealed partial class App : Application
{
    public App()
    {
        this.InitializeComponent();
        this.Suspending += OnSuspending;
        DebugSettings.BindingFailed += OnDebugSettingsOnBindingFailed;
    }

    private void OnDebugSettingsOnBindingFailed(object sender, BindingFailedEventArgs args)
    {
        new MessageDialog(args.Message).ShowAsync();
    }
    ...
}

Original source: http://www.tozon.info/blog/post/2012/07/23/Debugging-WinRTXAML-bindings.aspx

like image 187
Michael Kelley Avatar answered Sep 28 '22 08:09

Michael Kelley