-
-
Notifications
You must be signed in to change notification settings - Fork 144
DebugConverter
Antony Male edited this page Jan 6, 2015
·
3 revisions
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}}"/>
- Introduction
- Quick Start
- Bootstrapper
- ViewModel First
- Actions
- The WindowManager
- MessageBox
- The EventAggregator
- PropertyChangedBase
- Execute: Dispatching to the UI Thread
- Screens and Conductors
- BindableCollection
- Validation using ValidatingModelBase
- StyletIoC
- The ViewManager
- Listening to INotifyPropertyChanged
- Design Mode Support
- Logging
- Misc