views:

119

answers:

1

Debugging a binding when it is like this

IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, 
           AncestorType={x:Type ListBoxItem}}, Mode=TwoWay, Path=IsSelected}"

is easy. You add the following:

xmlns:diagnostics="clr-namespace:System.Diagnostics;assembly=WindowsBase"


IsChecked="{Binding RelativeSource={RelativeSource FindAncestor, 
           AncestorType={x:Type ListBoxItem}}, Mode=TwoWay, 
           Path=IsSelected,diagnostics:PresentationTraceSources.TraceLevel=High}"

But how do you attach the "debugger" when your binding looks like this:

<DataTemplate.Triggers>
    <DataTrigger Value="True">
        <DataTrigger.Binding>
            <MultiBinding Converter="{StaticResource DisableWorkItemConverter}">
                <Binding ElementName="MainForm" Path="PickedWorkItemID"/>
                <Binding Path="WorkItemForColumn.Id"/>
            </MultiBinding>
        </DataTrigger.Binding>
        <Setter Property="IsEnabled" Value="False"/>
        <Setter Property="loc:Main.IsCurrentItemEnabledChanged" Value="True"/>
    </DataTrigger>
</DataTemplate.Triggers>
+2  A: 

Hi Vaccano,

Sorry, I couldn't test it, but does this work?

  <DataTemplate.Triggers>
    <DataTrigger Value="True">
        <DataTrigger.Binding>
            <MultiBinding Converter="{StaticResource DisableWorkItemConverter}" 
                          diagnostics:PresentationTraceSources.TraceLevel="High">
                <Binding ElementName="MainForm" Path="PickedWorkItemID"/>
                <Binding Path="WorkItemForColumn.Id"/>
            </MultiBinding>
        </DataTrigger.Binding>
        <Setter Property="IsEnabled" Value="False"/>        
    </DataTrigger>

Hope it does :).

Anvaka
That did it. Thanks!
Vaccano