I had a problem when I was developing a WPF application with a TabControl object. I tried to debug and find the problem, and finally I succeeded, but I did not find a workaround for it. Here are a few explanations:
I used this data mesh filtering library ( here is the codeproject code ), which is the best (from my point of view). I want to customize it using the Google Material Design Theme and change some graphic functions, for example, using the toggle button in the header of the first tab as a data row to hide / show the filtering option.
I created a user control and placed my own datagrid in it. Then I embedded this control in tabItem. When I set this control to the first tabItem, everything works correctly. But when I change the user control to another tabItem, the toggle button does not work.
Here is my main xaml window code that didn't work:
<TabControl x:Name="tabControl">
<TabItem Header="1'st Tab">
<ContentControl DataContext="{Binding Path=DataContext, RelativeSource={RelativeSource AncestorType={x:Type Window}}}">
<Button Content="Do no thing"></Button>
</ContentControl>
</TabItem>
<TabItem Header="2'nd Tab">
<ContentControl DataContext="{Binding Path=DataContext, RelativeSource={RelativeSource AncestorType={x:Type Window}}}">
<local:UserControl1/>
</ContentControl>
</TabItem>
</TabControl>
Please note that if I reorder TabItems, it works well. Anyone have a suggestion to solve this problem? Here is my sample project code on Github

: "WPF Inspector", . , , "WPF Inspector" , . GIF - , :
