I was facing this issue and came across this question. I saw there were some answers where you needed to make this change in the treeview item style which required you to edit the default style. However, like the case above I too just needed the expander to be not visible when the node items are hidden. A simple way to do it is to expand all your nodes by default and use a property in the datatrigger for the treeviewItem style to set the treeview item visibility. This is how I was able to achieve it.
<Style x:Key="myTreeItemtyle" TargetType="{x:Type TreeViewItem}">
<Setter Property="IsExpanded" Value="True"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsVisible}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsVisible}" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
Now, use this style as the treeview item container style:
<TreeView Name="treeView" ItemsSource="{Binding TreeItems}" ItemContainerStyle="{StaticResource myTreeItemtyle}" BorderThickness="0"/>