Posts

Showing posts from August, 2009

ItemsControlMouseDragElementBehavior

This is a Behavior I created to allow Drag and reposition items in WPF Control that extend ItemsControl. After applying this behavior the user can at runtime click and drag any item while holding the control key. I created this behavior to support a application which required ability for the users to reposition items like icons on a desktop. Here is the screen cast of the sample application demonstrating this.

Selective Debugging for WPF Binding

  Have you ever pulled out your hair trying to figure out why / why not a particular value is (or not) being set on your control , what was wrong with the binding? I have seen people suggest exotic solutions where in there used a special converter so that they can debug the value being bound, or turn-on WPF tracing which generates a huge volume of trace statements that you will have to filter, well i found a easier way to debug just the one binding that matters by specifying a  binding attribute. 1: < UserControl 2: xmlns:diag ="clr-namespace:System.Diagnostics;assembly=WindowsBase" > 3: ... 4: ... 5: < Grid > 6: < TextBlock VerticalAlignment ="Center" Text ="{Binding Name,diag:PresentationTraceSources.TraceLevel=High}" /> 7: </ Grid >   this produces following output in your trace log 1: System.Windows.Data Warning: 54 : Path: 'Name'...