title: HasItems Property in TreeViewItem true, even if all children are Visibility = Collapsed
body: <p>Can you please give me a hint, to make HasItems Property better.
  I have a TreeView like this:</p>
  
  <pre><code>    &lt;TreeView ItemsSource="{Binding Customers}"&gt;
          &lt;TreeView.ItemContainerStyle&gt;
              &lt;Style TargetType="{x:Type TreeViewItem}"&gt;
                  &lt;Style.Triggers&gt;
                      &lt;DataTrigger Binding="{Binding HasItems, RelativeSource={RelativeSource Self}}" Value="True"&gt;
                          &lt;Setter Property="Foreground" Value="Red" /&gt;
                      &lt;/DataTrigger&gt;
                      &lt;DataTrigger Binding="{Binding HasItems, RelativeSource={RelativeSource Self}}" Value="False"&gt;
                          &lt;Setter Property="Foreground" Value="Blue" /&gt;
                      &lt;/DataTrigger&gt;
                  &lt;/Style.Triggers&gt;
                  &lt;Setter Property="AutomationProperties.AutomationId" Value="{Binding AutomationId}" /&gt;
                  &lt;Setter Property="IsExpanded" Value="True" /&gt;
                  &lt;Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" /&gt;
              &lt;/Style&gt;
          &lt;/TreeView.ItemContainerStyle&gt;
          &lt;TreeView.ItemTemplate&gt;
              &lt;HierarchicalDataTemplate ItemsSource="{Binding Customers}"&gt;
                  &lt;StackPanel Orientation="Horizontal"&gt;
                      &lt;TextBlock Text="{Binding Name}" /&gt;
                      &lt;TextBlock Text="{Binding FamilyName}" Margin="5,0,0,0" /&gt;
                  &lt;/StackPanel&gt;
              &lt;/HierarchicalDataTemplate&gt;
          &lt;/TreeView.ItemTemplate&gt;
      &lt;/TreeView&gt;
  </code></pre>
  
  <p>Code behind:</p>
  
  <pre><code>    public ObservableCollection&lt;Customer&gt; Customers { get; set; }
  
      public MainWindow()
      {
          InitializeComponent();
          DataContext = this;
          Customers = new ObservableCollection&lt;Customer&gt;();
  
          var homer = new Customer("Homer", "Simpson");
          homer.Customers.Add(new Customer("Bart", "Simpson"));
          homer.Customers.Add(new Customer("Lisa", "Simpson"));
          homer.Customers.Add(new Customer("Maggie", "Simpson"));
          var chief = new Customer("Chief", "Wiggum");
          chief.Customers.Add(new Customer("Ralf", "Wiggum"));
          Customers.Add(homer);
          Customers.Add(chief);
  
      }
  </code></pre>
  
  <p>The Class Customer implements INotifyPropertyChanged and everything is fine.
  As you see here, I have a DataTrigger to change color depending on "HasItems" Property of the TreeViewItem.
  The problem is: HasItems is true, even if all children are Hidden or Collapsed.</p>
  
  <p>See here: I made the VISIBILITY of son of "Chief Wiggum" Collapsed. And "Chief Wiggum"-TreeViewItem is still red.</p>
  
  <p><img src="https://i.stack.imgur.com/N1FUT.png" alt="With Ralfs TreeViewItem Collapsed"></p>