WPF - binding debug binding when the binding is not in the string

Debugging bindings when it looks like

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

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 a "debugger" when the 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>
+3
source share
1 answer

Sorry, I couldn’t check it, but does it 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 he is :).

+3
source

Source: https://habr.com/ru/post/1726811/


All Articles