WPF: How do I debug binding errors?

Posted by Jonathan Allen on Stack Overflow See other posts from Stack Overflow or by Jonathan Allen
Published on 2010-06-05T18:36:54Z Indexed on 2010/06/05 18:42 UTC
Read the original article Hit count: 788

Filed under:
|

I'm getting this in my output Window:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ItemsControl', AncestorLevel='1''. BindingExpression:Path=VerticalContentAlignment; DataItem=null; target element is 'ListBoxItem' (Name=''); target property is 'VerticalContentAlignment' (type 'VerticalAlignment')

This is my XAML, which when run looks correct

        <GroupBox Header="Grant/Deny Report">
            <ListBox ItemsSource="{Binding  Converter={StaticResource MethodBinder}, ConverterParameter=GrantDeny, Mode=OneWay}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="{Binding Entity}"/>
                            <Label Content="{Binding HasPermission}"/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </GroupBox>

© Stack Overflow or respective owner

Related posts about wpf

Related posts about wpf-binding