Only one of multiple TabControl
s interactable?
#17954
-
I'm working on an application where there is a "start page" that appears when no other document tabs are open. Before, this was handled by keeping the start page as an entry in the list of I thought a more elegant solution to the problem would be to have two TabControl elements defined to the same location, where the start page is simply made invisible when there are any open documents: <Grid>
<!-- Static Start Page -->
<TabControl>
<TabItem Header="Start Page" IsVisible="{Binding ShowStartMenu}">
...
</TabItem>
</TabControl>
<!-- Dynamic Pages -->
<TabControl ItemsSource="{Binding Documents}">
<TabControl.ItemTemplate>
...
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
...
</TabControl.ContentTemplate>
</TabControl>
</Grid> This almost works perfectly, except for whichever TabControl object that was defined first has no user interaction whatsoever. Is this a bug with how TabControls work (a la #14529 ), or have I set this system up incorrectly? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The second I would try making the control not visible when there are no documents so hit testing isn't processed: <TabControl IsVisible="{Binding !Documents.Count}" ItemsSource="{Binding Documents}"> |
Beta Was this translation helpful? Give feedback.
The second
TabControl
is still on top and likely still receiving hit tests and handling pointer events. LikelyTransparent
backgrounds for the header and content pane. If this is the case, then the behavior is consistent with expectations.I would try making the control not visible when there are no documents so hit testing isn't processed: