I will talk about four main points:
Here are two very important posts that explicit different solutions for debugging bindings:
- This post from Bea Stollnitz;
- This post from Karl Shifflet;
After reading those post, in WPF projects I use all those techniques in this order:
I define it in the resources of the application, and it’s done. I just have to call this converter on the binding where I encounter an issue. Automatically the debugger breaks in my converter. After solving the binding issue, I suppress the converter and that’s all.
I don’t really use the trace sources because most of times, I already found the issue before using it
In a previous post, I explained you my favorite tools, the two I use quickly to debug the visual tree of my application are Mole and Snoop.
Mole is useful when you set a breakpoint in Visual Studio and you want to debug the visual/logical tree of your application. It’s integrated into Visual Studio, when in your code you set a breakpoint, you can easily open Mole to understand what is happening in the visual or in the logical tree. I use Mole in Visual Studio, when debugging. I’m able to quickly find what’s happening –> incorrect owner, style not applied correctly, …
Snoop is different tool, also displays the visual tree of a WPF application, it is not working within Visual Studio. It takes the applications at a specific moment. It also displays in a tree control the visual tree to easily navigate into the elements but also allows to split the application in a 3D representation of all visual elements to better understand the graphical composition of the application. This allows to to better understand why part of your application is not docked correctly or stretched correctly.
Performance Profiling Tools for Windows Presentation Foundation (also know as WPFPerf) is available in the Microsoft Windows SDK for Windows 7 and the .NET Framework 4.
WPFPerf contains 2 tools :
I really use them when I really want to understand what is happening on a UI point of view, how the visual tree is build, how all the events/animations are
If you need more documentation on those tools, I redirect you to WPF Performance Suite on MSDN .
Here are my two main resources for optimization
Do not forget that WPF is also a part of .NET, so also use the Improving .NET Application Performance and Scalability form Pattern & Practice.
In this post I summarized some actions to do during a development life cycle on a WPF project.
And of course, you can follow a TechDays 2011 Session, from one of my colleague Luc Vo Van on WPF/Silverlight performance tips & tricks.