In my WPF application I have a ResourceDictionary
with some Controls:
<ResourceDictionary>
<Border x:Key="SystemBorder">
<!-- SomeContent -->
</Border>
<Border x:Key="DateBorder">
<!-- SomeContent -->
</Border>
<Button x:Key="QuitButton">
<!-- SomeContent -->
</Button>
</ResourceDictionary>
Now in my Window I have a TabControl
with some TabItem
, inside of every TabItem that Controls are in use.
But when I change Tabs everything is fine, but when I change back to a Tab, these Controls won't be there.
I tried to use x:Shared="False"
but it made no difference.
How can I solve that problem?
Edit:
Every TabItem has the same structure:
<TabItem>
<Grid>
<Grid.RowDefinitions/>
<!-- Defs -->
</Grid.RowDefinitions>
<Grid.ColumnDefinitions/>
<!-- Defs -->
</Grid.ColumnDefinitions>
</Grid>
<Border x:Name="Menu1" Grid.Row="0" Grid.Column="0">
<ContentControl x:Name="Date1" Content="{DynamicResource DateBorder}">
<!-- some Buttons -->
<ContentControl x:Name="QuitButton1" Content="{DynamicResource QuitButton}"/>
</Border>
<!-- some more Borders -->
<ContentControl x:Name="SystemBorder1" Grid.Row="3" Grid.Column="0" Content="{DynamicResource SystemBorder}"/>
</TabItem>
The DateBorder also have a Thread which updates the Date every second.