DebugConverter - canton7/Stylet GitHub Wiki
On every project ever I've needed to debug a binding. The easiest way of doing this is to put a converter on the binding, which does nothing except log the values it sees. DebugConverter
is an implementation of such a converter, and will log every call to Visual Studio's Output window, provided you're running a debug build.
Basic usage is very easy:
<TextBox Text="{Binding MyProperty, Converter={x:Static s:DebugConverter.Instance}}"/>
If you want to have several instances active at once, and want to give each one a name (which is included in its output), you can do this:
<!-- In any .Resources section - doesn't have to be Window.Resources -->
<Window.Resources>
<s:DebugConverter x:key="debugConverter" Name="MySpecialName"/>
</Window.Resources>
<!-- Later in code -->
<TextBlock Text="{Binding MyProperty, Converter={StaticResource debugConverter}}"/>