I have a tree control that exhibits very poor performance and I'm trying to track the source of the problem.

I am trying to work out whether warnings such as the following are important:

System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=ContextMenu.IsOpen; DataItem=null; target element is 'MultipleSelectionTreeViewItem' (Name=''); target property is 'NoTarget' (type 'Object')

The performance of updating the tree contents even with all these diags switched off is really dreadful (over a second to repopulate ~300 items), which is what started me looking at the trace output.

These warnings are spewed out by the dozen for each click in my tree view and when I switch the tree to display different contents, several hundreds of these warnings occur. However, the contents of the tree always appear correctly displayed so the data context must be getting set to null only transiently.

I put an explicit binding for DataContext with a value converter to try and see what is going on.

<HierarchicalDataTemplate x:Key="HierarchyItemTemplate"
                          DataType="{x:Type local:HierarchyItem}"
                          ItemsSource="{Binding Children}">
    <StackPanel DataContext="{Binding Converter={StaticResource DbgConverter}}" Orientation="Horizontal">
       ...
    </StackPanel>
</HierarchicalDataTemplate>

... but the value never seems to be equal to null coming into there.

I could set a fallback value for all the bindings to get rid of these warnings but that puts a lot of unnecessary mess in the xaml and seems like it's hiding the problem rather than solving it (assuming it is even a problem!).

So my question is:

  1. Are these diags likely to cause the performance problem?
  2. If so, would sup
Edit
Report