0

I get a runtime error that crashes when it tries to parse my XAML.

<TreeViewItem Header="{Binding Header}" ItemsSource="{Binding DataGroups}">
    <ListView ItemsSource="{Binding DataGroups}">
        <ListView.View>
            <GridView>
                <GridViewColumn Header="Group Name" DisplayMemberBinding="{Binding Path=Name}" />
                <GridViewColumn Header="Group Type" DisplayMemberBinding="{Binding Path=Type}" />
            </GridView>
        </ListView.View>
    </ListView>
</TreeViewItem>
amiry jd
  • 27,021
  • 30
  • 116
  • 215
Lee Louviere
  • 5,162
  • 30
  • 54

1 Answers1

0

After searching through all the questions related to this, I couldn't find the answer. Most involved people changing the Items property on the TreeViewItem, which will throw this error.

In my case, I didn't change anything.

However, if you notice.

<TreeViewItem Header="{Binding Header}" ItemsSource="{Binding DataGroups}">
    <ListView ItemsSource="{Binding DataGroups}">

I have bound to the same collection twice.

So, double check you haven't bound to the same collection twice if you get this error.

amiry jd
  • 27,021
  • 30
  • 116
  • 215
Lee Louviere
  • 5,162
  • 30
  • 54